0

I have a curious problem where I am given many strings in a list. For instance, the list may be:

[
    "Cartier 'Déclaration d'un Soir'",
    "Hue Cool",
    "Lagos Caviar™ Hoop"
]

As you can see the strings contain both normal characters as well as ascii codes. I want to convert it all to characters for a readable string.

I could go through and search for all &# character sets and convert from there using ; as the delimiter. I would think this would be rather inefficient though, and I need this to be as quick as possible. I also need to keep the code very clean. Does anyone know of a better way to go about making this work? Any suggestions are appreciated!

robert
  • 819
  • 1
  • 10
  • 24
  • 2
    Those are not ASCII characters. – Alexander Gessler Jul 06 '14 at 00:23
  • @AlexanderGessler what are they then? I only know ascii that have that type of syntax – robert Jul 06 '14 at 00:25
  • 2
    Those are [HTML character entities](http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references). In fact, you're seeing them here because they *can't* be represented in the ASCII character set (which, as a rule, covers only English text). – Michael Petrotta Jul 06 '14 at 00:28
  • Awesome! Thank you for the duplicate flag. It would have taken me forever to find that they are html character entities! – robert Jul 06 '14 at 00:34

0 Answers0