understanding on how to handle UTF-8 import/export
Peter TB Brett
peter.brett at livecode.com
Tue Dec 6 08:51:12 EST 2016
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
More information about the use-livecode
mailing list