Using 'read from socket' and 'write to socket'
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Using 'read from socket' and 'write to socket'
Hello,
When sending a Message to another Computer, using TCPIP Network, is it possible to send/receive french Characters ?
é è à for example are transformed to "bad" chars
Best Regards
Marc
When sending a Message to another Computer, using TCPIP Network, is it possible to send/receive french Characters ?
é è à for example are transformed to "bad" chars
Best Regards
Marc
thanks
this works fine
At reception, I then use:
replace "%8E" with "é" in data
At reception, I then use:
replace "%8E" with "é" in data
Dear Marc,
If you are establishing the connection yourself, using the "accept connections" and "open socket" commands, you can send any binary data you like. The data isn't really considered text if sent through a socket. It is simple "data" and your script turns it into something readable by reading the data from a socket and putting it into a field, for instance.
You really shouldn't use the replace function to decode a url. Instead, use the urlDecode function.
Best,
Mark
If you are establishing the connection yourself, using the "accept connections" and "open socket" commands, you can send any binary data you like. The data isn't really considered text if sent through a socket. It is simple "data" and your script turns it into something readable by reading the data from a socket and putting it into a field, for instance.
You really shouldn't use the replace function to decode a url. Instead, use the urlDecode function.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Dear Marc,Moskito67 wrote:URLEncodind é on Windows -> %8E
and on MAC OSX -> %E9
So... it seems not possible to encode and then decode when PC is speaking to Mac !
Whenever you send text from Mac to PC, you need to use the macToIso function to make the text readable on the PC. I believe the correct order is this:
put text from field into variable
put macToIso(variable) into variable
put urlEncode(variable) into variable
open socket
write variable to socket
close socket
accept connection
read from socket
close socket
put data into variable
put urlDecode(variable) into variabl
put text from variable into field
The above is only one of many possible approaches, but it should work.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Welcome to the wonderful world of crossplatform developmentMoskito67 wrote:URLEncodind é on Windows -> %8E
and on MAC OSX -> %E9
So... it seems not possible to encode and then decode when PC is speaking to Mac !

Well, I only SEEMS not to be possible!
As Makr already pointed out, you have to "convert" from mac to iso and vice versa if necessary...
The rest of the world ALWAYS uses the ISO format for strings, why not follow this convention?
I wrote two little functions that I use all the time for conterving text correctly whenever necessary:
Code: Select all
function mac2win tString
## We are on a Mac, so convert to ISO
if the platform = "MacOS" then
return mactoiso(tString)
else
## We are NOT on a Mac, so no conversion necessary
return tString
end if
end mac2win
function win2mac tString
if the platform = "MacOS" then
return isotomac(tString)
else
return tString
end if
end win2mac
Best
Klaus
Bonjour Moskito67,
yep, the Euro sign and some other characters are indeed a problem.
You could try to use HTML-text, that should be crossplatform (maybe not;-))
Like this:
<p>C'est une signée d'euro: ¤.</p>
Should read (attention! mon français c'est incroyablement mauvais
) on all platforms
after setting the htmltext of a field to this string:
C'est une signée d'euro: €.
Au revoir
Klaus
yep, the Euro sign and some other characters are indeed a problem.
You could try to use HTML-text, that should be crossplatform (maybe not;-))
Like this:
<p>C'est une signée d'euro: ¤.</p>
Should read (attention! mon français c'est incroyablement mauvais

after setting the htmltext of a field to this string:
C'est une signée d'euro: €.
Au revoir
Klaus