[quote=114169:@Walter Sander]What does the PHP function write into the Socket then ? Isn’t that a String ?
$frameHead[0] = chr($frameHead[0]); // this is an ü symbol and a print_r or var_dump of shows this vartype=string
maybe what I need to write into that TCPSocket is a Binary value, I don’t know, looks confusing to me
PHP handles variables much more easier because we don’t have to say if it is going to be an Integer or a String. PHP will figure it out for you and if you change the variable value from 1 to “1” it will automatically be changed from String to Integer.[/quote]
If you love so much undefined variables in PHP, you can use the Xojo Variant type, which will do the same. But don’t complain when you get a bug from it.
If I say “Pomme” in French or “Apple” in English, both mean the same fruit. With a 1982 IBM-PC and apparently your version of PHP, chr(129) means ü. With a Mac using a Mac Roman encoded font, chr(159 means ü. For a Windows machine, chr(252) means ü. Now what does the socket send ? If it is the web, here is the table for Web encoding : http://www.utexas.edu/learn/html/spchar.html. For a web browser, ü
means ü.
I know, it is confusing. In Xojo, &U00FC means ü no matter the system : Mac, Linux, Windows, Web. UTF-8 makes all system cooperate to fetch the right Unicode character.
This forum is not about PHP programming, it is on you to make the proper research. However, you may want to look the PHP chr manual :
http://php.net/manual/en/function.chr.php
This, in particular, seems to be what you need :
[code]Another quick and short function to get unicode char by its code.
<?php
/**
* Return unicode char by its code
*
* @param int $u
* @return char
*/
function unichr($u) {
return mb_convert_encoding('&#' . intval($u) . ';', 'UTF-8', 'HTML-ENTITIES');
}
?>[/code]