Generate xml file with encoding "UCS-2 LE BOM"?
-
wrote on 25 Aug 2020, 10:23 last edited by ablan
I am trying to create an xml file with the encoding "UCS-2 LE BOM" in Qt. How do I do so?
-
@ablan said in Generate xml file with encoding "UCS-2 LE BOM"?:
How do I do so?
See QTextCodec (UTF-16LE)
-
@ablan said in Generate xml file with encoding "UCS-2 LE BOM"?:
How do I do so?
See QTextCodec (UTF-16LE)
wrote on 26 Aug 2020, 02:22 last edited by ablanHi @Christian-Ehrlicher
I set the codec to UTF-16LE but the generated xml file when shown from Notepad++ is "UCS-2 Little Endian". -
Hi @Christian-Ehrlicher
I set the codec to UTF-16LE but the generated xml file when shown from Notepad++ is "UCS-2 Little Endian". -
wrote on 26 Aug 2020, 02:36 last edited by Bonnie
@ablan
My notepad++ doesn't have a "UCS-2 LE BOM"...It only has "UTF-8 BOM"
I think LE/BE means it already has BOM...
Without the BOM, how would it know the file is LE or BE?
So it doesn't need to add "BOM" to these two UCS-2 codecs' name... -
wrote on 26 Aug 2020, 03:00 last edited by
I have found the solution. When using QTextStream, use setGenerateByteOrderMark(true) and codec to "UTF-16LE", the output will then show as "UCS-2 LE BOM".
1/7