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#
  4. Convert utf16 to utf8

Convert utf16 to utf8

Scheduled Pinned Locked Moved C#
question
7 Posts 3 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.
  • C Offline
    C Offline
    Charith Jayasundara
    wrote on last edited by
    #1

    What is the most appropriate method to convert utf16 to utf8? Thanks,

    Charith Jayasundara

    G 1 Reply Last reply
    0
    • C Charith Jayasundara

      What is the most appropriate method to convert utf16 to utf8? Thanks,

      Charith Jayasundara

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Decode it into a string and encode it into UTF-8.

      Despite everything, the person most likely to be fooling you next is yourself.

      C 1 Reply Last reply
      0
      • G Guffa

        Decode it into a string and encode it into UTF-8.

        Despite everything, the person most likely to be fooling you next is yourself.

        C Offline
        C Offline
        Charith Jayasundara
        wrote on last edited by
        #3

        Can you please give an example or any link? Thanks!!!

        Charith Jayasundara

        G G 2 Replies Last reply
        0
        • C Charith Jayasundara

          Can you please give an example or any link? Thanks!!!

          Charith Jayasundara

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          This should help you: System.Text.Encoding[^]

          Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

          1 Reply Last reply
          0
          • C Charith Jayasundara

            Can you please give an example or any link? Thanks!!!

            Charith Jayasundara

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            Check out the Encoding.UTF8.GetString and Encoding.Unicode.GetBytes methods.

            Despite everything, the person most likely to be fooling you next is yourself.

            C 1 Reply Last reply
            0
            • G Guffa

              Check out the Encoding.UTF8.GetString and Encoding.Unicode.GetBytes methods.

              Despite everything, the person most likely to be fooling you next is yourself.

              C Offline
              C Offline
              Charith Jayasundara
              wrote on last edited by
              #6

              Actually there is no UTF16 in the Encoding class. (No Encoding.UTF16) Then what is the best way to convert it to a string? Thanks!

              Charith Jayasundara

              C 1 Reply Last reply
              0
              • C Charith Jayasundara

                Actually there is no UTF16 in the Encoding class. (No Encoding.UTF16) Then what is the best way to convert it to a string? Thanks!

                Charith Jayasundara

                C Offline
                C Offline
                Charith Jayasundara
                wrote on last edited by
                #7

                oh, Encoding.Unicode = Encoding.UTF16 :-) I got it, Thanks!

                Charith Jayasundara

                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