-
1. Re: socket connection: no utf-8 characters?
Dirk Becker Dec 30, 2009 2:37 AM (in response to Dr. TYPO)I do not know PHP, but I think there is something wrong at that side. Apparently setting the HTTP header to utf-8 plus wishful thinking does not change the applied output encoding of PHP. Besides, if you do not deliver HTML you should also use the correct MIME type text/plain.
Motörhead is 9 characters. Your reported content length is also 9 bytes, while the ö Umlaut should be encoded into at least 2 bytes.
Try the snippet below, an alternative is to ensure that your PHP source document is already utf-8 encoded.
<?php
header("Content-Type: text/plain; charset=utf-8");
echo utf8_encode("Motörhead");?>
http://en.wikipedia.org/wiki/MIME
http://php.net/manual/en/function.utf8-encode.php
http://linux.die.net/man/1/hexdump
Dirk
-
2. Re: socket connection: no utf-8 characters?
Dr. TYPO Dec 30, 2009 4:58 AM (in response to Dirk Becker)Hello Dirk,
thanks for the hint.
This does the trick:
in the php script the utf8 econded string must be published url encoded, otherwise in would be utf8 interpreted twice from the receiving ExtendScrip
echo urlencode(utf8_encode("Motörhead"));
and then in the ExtendScript decode the content, e.g.
alert (decodeURI(Result));
-
3. Re: socket connection: no utf-8 characters?
Dirk Becker Dec 30, 2009 6:11 AM (in response to Dr. TYPO)The second wrapper should not be required if your web site is supposed to deliver UTF8.
Instead you'd add a conversion step within ExtendScript.
E.g. use one of the JS UTF8 decoders from the web, or write the raw bytes out into a file then adjust the File.encoding variable for re-reading.
File.encoding is described in JavaScript Tools Guide, see the ESTK help menu.
Dirk
-
4. Re: socket connection: no utf-8 characters?
Dirk Becker Dec 30, 2009 6:12 AM (in response to Dirk Becker)Ah, I always forget that Socket also has its own .encoding variable. Just make sure it is set correctly.
Dirk

