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 an hexadecimal value to utf-8 encoding

convert an hexadecimal value to utf-8 encoding

Scheduled Pinned Locked Moved C#
tutorialquestion
8 Posts 4 Posters 1 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.
  • F Offline
    F Offline
    fady_sayegh
    wrote on last edited by
    #1

    Hello to all, how can i convert an hexadecimal value to utf-8 encoding example : 012b must returns in utf-8 i 0160 must returns in utf-8 Š best regards and thanks in advance Fady

    L J 2 Replies Last reply
    0
    • F fady_sayegh

      Hello to all, how can i convert an hexadecimal value to utf-8 encoding example : 012b must returns in utf-8 i 0160 must returns in utf-8 Š best regards and thanks in advance Fady

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, have a look at the Encoding class, in particular UTF8 property and GetChars/GetString methods. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Happy 2008!


      1 Reply Last reply
      0
      • F fady_sayegh

        Hello to all, how can i convert an hexadecimal value to utf-8 encoding example : 012b must returns in utf-8 i 0160 must returns in utf-8 Š best regards and thanks in advance Fady

        J Offline
        J Offline
        Jim Taylor
        wrote on last edited by
        #3

        string hex; hex = "012b"; hex = "0160"; int hexAsInteger = int.Parse(hex, System.Globalization.NumberStyles.HexNumber); char charValue = (char)hexAsInteger; MessageBox.Show(charValue.ToString());

        Jim

        F 1 Reply Last reply
        0
        • J Jim Taylor

          string hex; hex = "012b"; hex = "0160"; int hexAsInteger = int.Parse(hex, System.Globalization.NumberStyles.HexNumber); char charValue = (char)hexAsInteger; MessageBox.Show(charValue.ToString());

          Jim

          F Offline
          F Offline
          fady_sayegh
          wrote on last edited by
          #4

          thanks a lot Luc Pattyn and Jim Fady

          E 1 Reply Last reply
          0
          • F fady_sayegh

            thanks a lot Luc Pattyn and Jim Fady

            E Offline
            E Offline
            ellllllllie
            wrote on last edited by
            #5

            try this UInt16Converter utf8 = new UInt16Converter(); char MyChar = '\x012b'; MessageBox.Show(utf8.ConvertToString(MyChar));

            dghdfghdfghdfghdgh

            E L 2 Replies Last reply
            0
            • E ellllllllie

              try this UInt16Converter utf8 = new UInt16Converter(); char MyChar = '\x012b'; MessageBox.Show(utf8.ConvertToString(MyChar));

              dghdfghdfghdfghdgh

              E Offline
              E Offline
              ellllllllie
              wrote on last edited by
              #6

              or try this char MyChar = '\x012b'; MessageBox.Show(MyChar.ToString());

              dghdfghdfghdfghdgh

              1 Reply Last reply
              0
              • E ellllllllie

                try this UInt16Converter utf8 = new UInt16Converter(); char MyChar = '\x012b'; MessageBox.Show(utf8.ConvertToString(MyChar));

                dghdfghdfghdfghdgh

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                I was unaware of class UInt16Converter. However the MSDN doc says "You should never create an instance of a UInt16Converter. Instead, call the GetConverter method of TypeDescriptor." So you may want to modify your code snippet. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                Happy Holidays!


                E 1 Reply Last reply
                0
                • L Luc Pattyn

                  I was unaware of class UInt16Converter. However the MSDN doc says "You should never create an instance of a UInt16Converter. Instead, call the GetConverter method of TypeDescriptor." So you may want to modify your code snippet. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  Happy Holidays!


                  E Offline
                  E Offline
                  ellllllllie
                  wrote on last edited by
                  #8

                  hehe see the last reply

                  dghdfghdfghdfghdgh

                  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