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. Character code for string in other language

Character code for string in other language

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++helpquestionannouncement
5 Posts 2 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.
  • A Offline
    A Offline
    Andy Rama
    wrote on last edited by
    #1

    Hi to all, Someone helped me on other forum to convert a string in any language to it's bytes format, using following code. string s = "François"; byte[] unicodeBytes = Encoding.Unicode.GetBytes(s); byte[] aBytes = Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(28599), unicodeBytes); He told me to use WideCharToMultiByte() in C++ for above C# code. He help me a lot. But I want to know that, is there any method to get the character code for given value in string s to convert that string in bytes? Is there any software or dlls to release the application with some evalution period? Regards, Aniket A. Salunkhe

    _ 1 Reply Last reply
    0
    • A Andy Rama

      Hi to all, Someone helped me on other forum to convert a string in any language to it's bytes format, using following code. string s = "François"; byte[] unicodeBytes = Encoding.Unicode.GetBytes(s); byte[] aBytes = Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(28599), unicodeBytes); He told me to use WideCharToMultiByte() in C++ for above C# code. He help me a lot. But I want to know that, is there any method to get the character code for given value in string s to convert that string in bytes? Is there any software or dlls to release the application with some evalution period? Regards, Aniket A. Salunkhe

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You can typecast each character using wchar_t to get the unicode value or using char to get the ascii value.

      int i = wchar_t(s[0]);
      int j = char(s[0]);

      «_Superman_»

      A 1 Reply Last reply
      0
      • _ _Superman_

        You can typecast each character using wchar_t to get the unicode value or using char to get the ascii value.

        int i = wchar_t(s[0]);
        int j = char(s[0]);

        «_Superman_»

        A Offline
        A Offline
        Andy Rama
        wrote on last edited by
        #3

        I am getting wrong output when I have string in Arabic Language. I want to convert a string (in any langauge) to bytes format as geiven in Annex A of ETSI EN 300 468 V1.9.1 (2008-11) Digital Video Broadcasting (DVB) : Specification for Service Information (SI) in DVB systems For that someone has suggested to use System.Text.Encoding. But to use that, I must know the codepage before compilation. So is there any method to retrieve codepage?

        _ 1 Reply Last reply
        0
        • A Andy Rama

          I am getting wrong output when I have string in Arabic Language. I want to convert a string (in any langauge) to bytes format as geiven in Annex A of ETSI EN 300 468 V1.9.1 (2008-11) Digital Video Broadcasting (DVB) : Specification for Service Information (SI) in DVB systems For that someone has suggested to use System.Text.Encoding. But to use that, I must know the codepage before compilation. So is there any method to retrieve codepage?

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          Aniket Salunkhe wrote:

          So is there any method to retrieve codepage?

          You can get code page information using APIs like GetACP, GetCPInfo etc.

          «_Superman_»

          A 1 Reply Last reply
          0
          • _ _Superman_

            Aniket Salunkhe wrote:

            So is there any method to retrieve codepage?

            You can get code page information using APIs like GetACP, GetCPInfo etc.

            «_Superman_»

            A Offline
            A Offline
            Andy Rama
            wrote on last edited by
            #5

            Hi, Thanks for suggestion. But if I am having two strings s1 & s2, each having value in 2 distinct languages, how can I use above functions to convert them (there characters) into byte format? Thanks & Regards, Aniket A. Salunkhe

            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