Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. compilation of UTF-8 in visual cpp

compilation of UTF-8 in visual cpp

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
5 Posts 4 Posters 0 Views 1 Watching
  • 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.
  • P Offline
    P Offline
    puneet_cha
    wrote on last edited by
    #1

    hi all Is it possible to compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16? if it is possible do let me know ho it is possible. thanks in advance

    S B M 3 Replies Last reply
    0
    • P puneet_cha

      hi all Is it possible to compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16? if it is possible do let me know ho it is possible. thanks in advance

      S Offline
      S Offline
      sGrabert
      wrote on last edited by
      #2

      The project option "Character Set" could be what you are looking for. There are three settings avaiable: - Use Multi-Byte Character Set - Use Unicode Character Set - not set This option can be set in the project configuration->General.

      1 Reply Last reply
      0
      • P puneet_cha

        hi all Is it possible to compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16? if it is possible do let me know ho it is possible. thanks in advance

        B Offline
        B Offline
        bob16972
        wrote on last edited by
        #3

        puneet_cha wrote:

        compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16?

        Neither option is available. The "Unicode" option was put in place back when "Unicode" was only 16-bits and did not use surrogate pairs or groups. The term UCS-2 is probably closer to Windows "Unicode" or the compiler "Unicode" option. UTF-16 has 16-bit code units but can use surrogate pairs to represent unicode code points that require more than 16-bits to represent them. Windows "Unicode" is simply 16-bits for every code point, no more, no less. UCS-2 and UTF-16 map the same but the code units that are used to represent the first part of a surrogate grouping in UTF-16 are ignored in UCS-2. However, UCS-2 and UTF-16 as well as the term "Unicode" are still mistakenly used interchangeably which causes some confusion.

        B 1 Reply Last reply
        0
        • B bob16972

          puneet_cha wrote:

          compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16?

          Neither option is available. The "Unicode" option was put in place back when "Unicode" was only 16-bits and did not use surrogate pairs or groups. The term UCS-2 is probably closer to Windows "Unicode" or the compiler "Unicode" option. UTF-16 has 16-bit code units but can use surrogate pairs to represent unicode code points that require more than 16-bits to represent them. Windows "Unicode" is simply 16-bits for every code point, no more, no less. UCS-2 and UTF-16 map the same but the code units that are used to represent the first part of a surrogate grouping in UTF-16 are ignored in UCS-2. However, UCS-2 and UTF-16 as well as the term "Unicode" are still mistakenly used interchangeably which causes some confusion.

          B Offline
          B Offline
          bob16972
          wrote on last edited by
          #4

          bob16972 wrote:

          Neither option is available.

          Or is it? I got to thinking, and I've not checked VC++ 2005 or beyond. Do they still use "MBCS" and "UNICODE" for compiler options or have they finally started using encoding terms to describe the options. Does VC++ 2005 or beyond use "UTF-16" and "UTF-8" instead of "MBCS" and "UNICODE" for the compiler options. I came across a blog stating that Windows XP and above started supporting surrogates so it could be officially called UTF-16 on those operating systems. However, this would conflict with the wide character nature of BSTR and wide chars so I'm guessing the surrogates would still be illegal code units. Anyone have any info?

          1 Reply Last reply
          0
          • P puneet_cha

            hi all Is it possible to compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16? if it is possible do let me know ho it is possible. thanks in advance

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            UTF-8 is not supported natively in Windows. Your choices are MBCS or UTF-16 ("Unicode"). You'll need to convert your strings to UTF-8 manually whenever you need UTF-8.

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Hungarian notation FTW

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups