Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Generate xml file with encoding "UCS-2 LE BOM"?
Forum Updated to NodeBB v4.3 + New Features

Generate xml file with encoding "UCS-2 LE BOM"?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ablan
    wrote on 25 Aug 2020, 10:23 last edited by ablan
    #1

    I am trying to create an xml file with the encoding "UCS-2 LE BOM" in Qt. How do I do so?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 25 Aug 2020, 15:36 last edited by
      #2

      @ablan said in Generate xml file with encoding "UCS-2 LE BOM"?:

      How do I do so?

      See QTextCodec (UTF-16LE)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      A 1 Reply Last reply 26 Aug 2020, 02:22
      2
      • C Christian Ehrlicher
        25 Aug 2020, 15:36

        @ablan said in Generate xml file with encoding "UCS-2 LE BOM"?:

        How do I do so?

        See QTextCodec (UTF-16LE)

        A Offline
        A Offline
        ablan
        wrote on 26 Aug 2020, 02:22 last edited by ablan
        #3

        Hi @Christian-Ehrlicher
        I set the codec to UTF-16LE but the generated xml file when shown from Notepad++ is "UCS-2 Little Endian".

        B 1 Reply Last reply 26 Aug 2020, 02:26
        0
        • A ablan
          26 Aug 2020, 02:22

          Hi @Christian-Ehrlicher
          I set the codec to UTF-16LE but the generated xml file when shown from Notepad++ is "UCS-2 Little Endian".

          B Offline
          B Offline
          Bonnie
          wrote on 26 Aug 2020, 02:26 last edited by
          #4

          @ablan
          What's the problem?
          Little Endian = LE

          A 1 Reply Last reply 26 Aug 2020, 02:29
          1
          • B Bonnie
            26 Aug 2020, 02:26

            @ablan
            What's the problem?
            Little Endian = LE

            A Offline
            A Offline
            ablan
            wrote on 26 Aug 2020, 02:29 last edited by
            #5

            @Bonnie
            Yes, but it is not showing as "UCS-2 LE BOM".

            B 1 Reply Last reply 26 Aug 2020, 02:36
            0
            • A ablan
              26 Aug 2020, 02:29

              @Bonnie
              Yes, but it is not showing as "UCS-2 LE BOM".

              B Offline
              B Offline
              Bonnie
              wrote on 26 Aug 2020, 02:36 last edited by Bonnie
              #6

              @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...

              1 Reply Last reply
              0
              • A Offline
                A Offline
                ablan
                wrote on 26 Aug 2020, 03:00 last edited by
                #7

                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 Reply Last reply
                3

                6/7

                26 Aug 2020, 02:36

                • Login

                • Login or register to search.
                6 out of 7
                • First post
                  6/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved