Question

I'm trying to insert the sign in Excel with the Com Object from PHP

I've tried using chr(242), ó but I get only characters from ISO-8859-1 charset

I now have no idea what to use to insert the character.

Here is my function :

$string = str_replace('>=', chr(242), $string);
Was it helpful?

Solution

Not sure what's giving you the idea that 242 in any way resolves to "≥". chr simply gives you the byte value for that number, and "≥" is not in ISO-8859 or any other single-byte encoding I know of. For the UTF-8 encoded value, use "\xE2\x89\xA5", or simply '≥' if you encode your source code in UTF-8.

Excel notoriously sucks with encodings though, so I don't know that this will actually display correctly in Excel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top