Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text file conversation from ISO-8859-2 to UTF-8
#1
I have a text file that is stored in ISO-8859-2 format and I would like to convert it to UTF-8. Is it possible to do it? Thank you.
#2
Macro
Code:
Copy      Help
str sFile="thefile"
str sData
sData.getfile(sFile)
sData.unicode(sData 28592) ;;iso-8859-2 -> UTF-16. The 28592 is from "Code Page Identifiers" table from MSDN library.
sData.ansi(sData CP_UTF8) ;;UTF-16 -> UTF-8
sData.setfile(sFile)

Not tested.
Does not depend on whether QM is running in Unicode mode or not.
#3
Yes, it works.
In my code, I forgot to use s.ansi(s CP_UTF8) to convert from UTF16->UTF8. But it is clear now.
Thank you.
#4
I would like to convert into UTF-8 the following line in a .txt (.eml) file.

Subject: =?ISO-8859-7?B?RmF4IOrh6SBBY3JvYmF0IFdyaXRlcnMgzO/t3OT57SDRwcU=?=



Code page identifier is 28597.

I would appreciate any advice.

Thanks in advance.
#5
Macro Macro1191
Code:
Copy      Help
str s="RmF4IOrh6SBBY3JvYmF0IFdyaXRlcnMgzO/t3OT57SDRwcU="
s.decrypt(4) ;;decode base64
;out s

s.unicode(s 28597) ;;ISO-8859-7 -> UTF-16
s.ansi ;;UTF-16 to QM code page (UTF-8 in Unicode mode)
out s
#6
Dear Gintaras,

Once again many thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)