Decode xml-data of mac-adressbook
Sarah Reichelt
sarah.reichelt at gmail.com
Thu Jan 18 18:11:09 EST 2007
> > on Mac OSX I try to get the contents of the
> > adressbook;
> > for each adress there is a xml-file in
> > /Users/..../Library/Caches/
> > com.apple.AdressBook/Metadata.
> >
> > The xml-file starts with
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > My adresses are german ones, so there are "umlauts"
> > like ŠšŸ...
> > If in the adressbook the city is "HŸrth" and I read
> > the file contents by
> > put url("file:/" & xmlfilename) into tdata,
> > I get "Hürth" instead.
> >
> > As I don«t know enough about encoding, may you give
> > me a tip, what to
> > do to get the right chars?
> >
> > Thank you.
> >
> > Richard.
> >
>
> Hi Richard,
>
> You'll have to use the 'uniEncode' and 'uniDecode'
> functions to convert it from UTF-8 to UTF-16 and then
> back to 1-byte characters. Here's a link to a post by
> Mark Waddingham:
> <http://mail.runrev.com/pipermail/use-revolution/2006-January/074653.html>
>
This certainly helped for reading XML data correctly but I can't
figure out how to write it back out to an XML file once it contains
accented characters.
I've tried numerous combinations of uniEncde, uniDecode, macToIso etc
and I either lose the accented characters completely or they become
something else or the file is empty or it doesn't read properly.
Does anyone know how to write accented chars into an XML text file? I
use the revXMLText() function to get the XML tree as text then save it
to a file.
TIA,
Sarah
More information about the use-livecode
mailing list