Hi there,
I have this very simple PHP code as a test : <?php $chaine = "é"; echo ord($chaine[0])." ".ord($chaine[1]); ?> The $chaine variable is initialized with «é» (e with acute accent) just in case…
If I save this file in UTF-8 as usual and use the “Run” command, it returns “195 169”, as it should : it's the UTF-8 representation of the letter é. But if I save this same file in ISO-8859-1 and use the “Run” command once again, I still have “195 169” whereas I should have “233” (representation of é in ISO-8859-1).
Note that I don't have any problem if I host the files on a server somewhere. Therefore, it seems to be a small bug with the PHP “Run” command which returns the UTF-8 representation no matter what…
Thanks in advance :-)
On 6. Nov 2006, at 12:40, guerom00 wrote:
[...] But if I save this same file in ISO-8859-1 and use the “Run” command once again, I still have “195 169” whereas I should have “233” (representation of é in ISO-8859-1).
The command takes the document as stdin, and runs that through PHP, and stdin is always UTF-8.
You would have to change the command to use a file name, if you need it to use the encoding of your file, but then you lose the ability to run untitled documents.
Allan Odgaard <throw-away-1@...> writes:
On 6. Nov 2006, at 12:40, guerom00 wrote:
[...] But if I save this same file in ISO-8859-1 and use the “Run” command once again, I still have “195 169” whereas I should have “233” (representation of é in ISO-8859-1).
The command takes the document as stdin, and runs that through PHP, and stdin is always UTF-8.
You would have to change the command to use a file name, if you need it to use the encoding of your file, but then you lose the ability to run untitled documents.
Thanks Allan. I don't think I want to bother… It was really an exceptional case based on the encoding…