Hi Matthias,

On 2017-01-16 18:25, Matthias Rebbe via use-livecode wrote:
It would have been nice if you had also put some sample code for how
to UTF8 encode the string.
That would have made your explanations complete. ;)

Sure - here is how I'd slightly adjust Tiemo's code:

*put fld "name" into myName*
-- ...
*open file myFile for binary write*
*write textEncode(myName, "utf8") to file myFile*
*close file myFile*
-- ...
*open file myFile for binary read*
*read from file myFile until EOF*
*close file myFile*
*put textDecode(it, "utf8") into myName*
-- ...
*put URL ("http://myUser:myPW@myURL"; & "mySQL.php?" & URLEncode(textEncode(theName, "utf8")))
into rslt*
-- mySQL.php writes to a MySQL db, where theName column is encoded as
"utf8_general_ci"

The missing piece here is PHP configuration on the other side. I'm assuming that PHP is doing the following:
   1) URLDecode the part after '?' into bytes
   2) Interpret the bytes as Latin-1 encoded text
   3) Passing the text string to the appropriate MySQL function
   4) The MySQL function is converting the text string to UTF-8

This may or may not be the case. If 'theName' is encoded as UTF8 before being URLEncode, all that needs to be checked is that the PHP (on the other end) is decoding it into a string as UTF-8 before passing it to MySQL.

Warmest egards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to