I ran into a problem with a project where I receive data from a device, unzip them and then try to load the result back into Xojo. Result is an XML file with encoding ISO-8859-15 (Latin 9). I had the idea to process this file as a text stream, convert its data to UTF-8 and change the encoding tag manually. But maybe there are more elegant ways?
Load the raw text into a memoryblock, transform the 8 characters that are different from ISO-8859-1 (there’s a list on wikipedia) then load its as ISO-8859-1 ?
or something like that ?
In a way I did so:
dim mb as Xojo.Core.MemoryBlock = bStream.Read(bStream.Length)
temptext = xojo.core.TextEncoding.FromIANAName("ISO-8859-15").ConvertDataToText(mb, true)
temptext = temptext.ReplaceAll(Encodings.ISOLatin9.internetName, Encodings.UTF8.internetName)
temptext = temptext.ConvertEncoding(Encodings.UTF8)
then writing it back to a file and using this ones folderitem for an XML constructor. Seems to work ok.