Importing and export text with foreign accents

Mark Waddingham 36degrees at runrev.com
Mon Mar 6 05:44:44 EST 2006


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" ?>

Hope this helps,

Mark.

------------------------------------------------------------------
  Mark Waddingham ~ 36degrees at runrev.com ~ http://www.runrev.com
        Runtime Revolution ~ User-Centric Development Tools





More information about the Use-livecode mailing list