Importing and export text with foreign accents

Klaus Major klaus at major-k.de
Mon Mar 6 10:36:40 EST 2006


Hi Mark,

> Hi Derek,
>
>> I'm having a little trouble importing a tab deliminted text file
>> (saved from excel), having rev organize it, then saving it out as an
>> xml file.
>>
>> The import and text manipulation works just fine, but when it comes
>> time to export the data out to text files, all the foreign characters
>> (accents, umlauts, etc,) get converted to squares or questions marks.
>
> Hmmm - sounds like your data is undergoing an inappropriate  
> conversion at some point (or *not* undergoing a conversion).
>
> Revolution natively runs in character encoding that depends on  
> platform:
>   MacOS - MacRoman
>   Win32 - Windows Latin-1
>   Unix  - ISO 8859-1
>
> So, when you save out data, it will (by default) save it out using  
> that character set.
>
> The only time you have to be concerned about the encoding is when  
> you are doing an explicit format conversion - which you are in this  
> case as you are saving out as XML.
>
> My guess would be that, in your case, you are writing the data out  
> to XML and then another application is loading it and *assuming* it  
> is in UTF-8 thus resulting in the effect you see.
>
> To fix this, you either need to convert your string data to UTF-8  
> before writing to the XML file:
>   put uniDecode(uniEncode(tASCIIText), "UTF8") into tUTF8Text
>
> Or, change the encoding of the XML file by using:
>   <?xml version="1.0" encoding="iso-8859-1" ?>

does that means that the Rev XML external does not care about the  
encoding
resp. does not take the first line with an eventual encoding param  
into account?

I found that XML files written by the external on a mac do have this  
header:
<?xml version="1.0"?>

and this on windows:
  <?xml version="1.0" encoding="iso-8859-1" ?>

So we are supposed to take care of the correct (crossplatform)  
encoding by ourselves?

> Hope this helps,
>
> Mark.

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list