Why do I still need MacToISO, when working with UTF-8?

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Mon Jan 16 18:37:46 CET 2017

Hi Mark,

thanks for that.

> Am 16.01.2017 um 18:30 schrieb Mark Waddingham via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
> 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*

I always thought, that binary reading a text file would result into a string with the same encoding and  line endings.
So when i binary read UTF8 files  i still have to textDecode it to UTF8?

> -- ...
> *put URL ("http://myUser:myPW@myURL <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 ~ mark at livecode.com <mailto:mark at livecode.com> ~ http://www.livecode.com/ <http://www.livecode.com/>
> LiveCode: Everyone can create apps
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list