I have a string like this (taking the example from Wikipedia):
In parsing this, I get that the encoding is iso-8859-1, which I parse off into a text variable. As this is a text value, I want to use the following to convert this to a TextEncoding value:
dim tenc as TextEncoding, tmpstr as string, iana as text
tenc = Xojo.Core.TextEncoding.FromIANAName (iana)
tmpstr = DecodeQuotedPrintable (mdl, tenc)
but I get an error message: Parameter “encoding” expects class TextEncoding, but this is class Xojo.Core.TextEncoding.
How can I get around this?
Either your need DecodeQuotedPrintable in the new framework. Or you try without the encoding. The docs say
[quote]Optional: The text encoding of the passed string.
If you pass an encoding, is has the same effect as calling DefineEncoding on the returned String.[/quote]
Unfortunately this just pushes the problem down the road. With the code above, my next step would be:
dim retstr as text
retstr = tmpstr.ConvertEncoding(Encodings.UTF8).ToText
If I remove the optional encoding from
DecodeQuotedPrintable, then instead I need:
retstr = tmpstr.DefineEncoding(tenc).ConvertEncoding(Encodings.UTF8).ToText
which gives the same errormessage, but on
DefineEncoding rather than
I’d say that you have to use the old framework and not the new one. If you want I can post the code for this.
I’d appreciate it, thanks. I went onto the new framework because the old didn’t seem to provide a simple method to convert an encoding given as a string, such as “ASCII”, or “iso-8859-1”, to a TextEncoding.