This is what I originally tested first (see my original post), but it didn't
worked. The Umlaute (coming from a Mac client) entered the mySQL db
corrupted. I don't know, if I could configure anything in my PHP or my db
different to make this solution work. But since everything worked always
fine with a windows client, I didn't wanted to change anything in my PHP or
MySQL and so the MacToISO() conversion on a Mac client is a good solution
for my case.
Tiemo


-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] Im Auftrag
von Mark Waddingham via use-livecode
Gesendet: Montag, 16. Januar 2017 18:30
An: How to use LiveCode <use-livecode@lists.runrev.com>
Cc: Mark Waddingham <m...@livecode.com>
Betreff: Re: Why do I still need MacToISO, when working with UTF-8?

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


_______________________________________________
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