prakob Posted June 29, 2011 Share Posted June 29, 2011 Hi all, I'm developing an interprocess communication via socket. I use AutoIt as server and other languages (ei Javascript, php) as clients. Everything is fine until I try to send/receive non English chars. I know most characters mapping will not have problems with English (ei ASCII, UTF8, etc). I know AutoIt supports for UTF16 in code. What I don't know is what charset AutoIt uses in TCP ? Where and how to control/convert the charset ? What is the best charset to TCP with autoIt in order cover most human languages ? Any advise/comment are most welcome. Regards Prakob Link to comment Share on other sites More sharing options...
jchd Posted June 29, 2011 Share Posted June 29, 2011 The most prevalent encoding is UTF-8 as shown by headers in most pages not using latin charset.For instance, this page uses:<meta http-equiv="content-type" content="text/html; charset=UTF-8" />UTF-8 has the big advantage of being immune to byte order (endianness).Take your AutoIt (UTF-16) native strings and send their UTF-8 counterpart. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
prakob Posted June 29, 2011 Author Share Posted June 29, 2011 The most prevalent encoding is UTF-8 as shown by headers in most pages not using latin charset.For instance, this page uses:<meta http-equiv="content-type" content="text/html; charset=UTF-8" />UTF-8 has the big advantage of being immune to byte order (endianness).Take your AutoIt (UTF-16) native strings and send their UTF-8 counterpart.Hi jchd,Thanks for your response. I've tried encode ASCII to UTF8 in javascript and send it to autoIt socket server and use autoIt BinaryToString (binary, 4) to get it. This works fine in autoIt the sent data is correct. In the way back (autoIt to javascript), I've tried autoIt StringToBinary ( string, 4) and send it back to javascript unfortunately this does not work in javascript. The convertion came out all wrong. I'm not so sure why it does not work. Any advise ? Link to comment Share on other sites More sharing options...
jchd Posted June 29, 2011 Share Posted June 29, 2011 Can you post a sample of the data as you receive it, before any conversion? Are you certain the client sends UTF-8? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
prakob Posted June 29, 2011 Author Share Posted June 29, 2011 Can you post a sample of the data as you receive it, before any conversion?Are you certain the client sends UTF-8?It was my mistake in conversion. It's solved now. The working schema is as above post and it's working very fast indeed.Thanks for your attention jchd. Link to comment Share on other sites More sharing options...
jchd Posted June 29, 2011 Share Posted June 29, 2011 You're welcome. I've had knots with Unicode encodings before and I'm always glad to help people get around them, when I can. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now