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. html entity to unicode

html entity to unicode

Scheduled Pinned Locked Moved C / C++ / MFC
c++htmlhelptutorialquestion
4 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.
  • M Offline
    M Offline
    micutzu
    wrote on last edited by
    #1

    Hello, I have a tricky problem and I hope anyone can point me a solution. I have an C++ Unicode application that received a parameter form the browser. If the parameter is a Greek word for example, I get something like this &u=%u03C5%u03B2%u03AD& (html entities). Does anyone know an efficient method to convert the html entity into the Greek character? Thanks.

    N 1 Reply Last reply
    0
    • M micutzu

      Hello, I have a tricky problem and I hope anyone can point me a solution. I have an C++ Unicode application that received a parameter form the browser. If the parameter is a Greek word for example, I get something like this &u=%u03C5%u03B2%u03AD& (html entities). Does anyone know an efficient method to convert the html entity into the Greek character? Thanks.

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      micutzu wrote:

      &u=%u03C5%u03B2%u03AD&

      one doubt. In the above string does 03c5,03b2... represents some Greek character?

      nave

      M 1 Reply Last reply
      0
      • N Naveen

        micutzu wrote:

        &u=%u03C5%u03B2%u03AD&

        one doubt. In the above string does 03c5,03b2... represents some Greek character?

        nave

        M Offline
        M Offline
        micutzu
        wrote on last edited by
        #3

        Yes. They are. I want to obtain the unicode character represented by 03c5.

        N 1 Reply Last reply
        0
        • M micutzu

          Yes. They are. I want to obtain the unicode character represented by 03c5.

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          I think the below code will work.. wchar_t* ptext = _T("%u03C5%u03B2%u03AD&"); wchar_t* pEntity = new wchar_t[ _tcslen( ptext ) + 1]; _tcscpy( pEntity, ptext ); /// in u r case u can start from here wchar_t pGreek[50] = {0}; int ncount = _tcslen( pEntity ); int nChar = 0; wchar_t *pStart = pEntity + 2; for( int i = 0, j = 0; i< ncount-2; j++, i += 6 ) { *(pStart + 4) = 0; *(pStart + 5) = 0; swscanf( pStart , _T("%x"), &nChar ); pGreek[j] = nChar; pStart+= 6; } AfxMessageBox( pGreek); delete[] pEntity;

          nave

          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