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. Convert unicode string into ascii text with numeric character references

Convert unicode string into ascii text with numeric character references

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresxmltutorialquestion
1 Posts 1 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.
  • L Offline
    L Offline
    Leif Simon Goodwin
    wrote on last edited by
    #1

    We have some old code which creates an XML document tree, using IXMLDocument and related interfaces. Anyway, some code creates a text node and we pass in text such as "5.0 £" or "2.5 €". The currency characters are non ASCII and are not valid in an XMl text node. For example this is invalid: 2.5 € It needs to be translated as follows: 2.5 &#euro; I can process the string e.g. "2.5 €" replacing each non ASCII character with a numeric character reference, and then create the XML text node. Is there a better way to convert the CString content to XML compliant text? I cannot find anything in Microsoft code. (As far as I can see Xerces would handle this but we do not use Xerces.)

    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