AW: understanding on how to handle UTF-8 import/export

Tiemo Hollmann TB toolbook at kestner.de
Tue Dec 6 15:13:05 CET 2016


Thanks Peter, that works fine.
Perhaps you could add a cross reference in the docs at uniEncode/uniDecode
to textEncode/textDecode, that would have helped me.
I know, that there was written a lot about UTF-8 when it was released in
LC7, but if you don't need it at that time, it is hard to find the related
links later when you need it.
Tiemo


-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im Auftrag
von Peter TB Brett
Gesendet: Dienstag, 6. Dezember 2016 14:51
An: How to use LiveCode <use-livecode at lists.runrev.com>
Betreff: Re: understanding on how to handle UTF-8 import/export

On 06/12/2016 13:42, Tiemo Hollmann TB wrote:
> In my LC 6 programs I have uniEncoded and uniDecoded text when 
> exporting/importing text to an xml file via revXML.
>
> Now with LC 8 everything internal in LC is UTF-8 and since 
> uniDecode/uniEncode is deprecated my first thought was, that I could 
> straight export/import text from LC fields into an xml file 
> (encoding=UTF-8), without any special charset handling anymore. But 
> obviously this isn't the fact. Doing so, the text is corrupted in the 
> xml file (checking with an editor) and trying to import the file 
> again, fails with an import error regarding the encoding of the file. 
> Using my old mechanic with the deprecated functions 
> uniDecode/uniEncode still works fine, but I shouldn't use these functions
anymore.

Hi Tiemo,

I think you have run into bug 18927 [1].

You can use the textEncode() function to encode strings to UTF-8 before
passing them to revXML commands.  For example:

     revXMLSetAttribute tTheTreeID,"root/node1", "myAttribute", \
           textEncode(the text of fld "Input","utf-8")

I hope that helps.

                                                     Peter

[1] http://quality.livecode.com/show_bug.cgi?id=18927

--
Dr Peter Brett <peter.brett at livecode.com> LiveCode Technical Project Manager

lcb-mode for Emacs: https://github.com/peter-b/lcb-mode

_______________________________________________
use-livecode mailing list
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