Converting Unicode Escape Sequences to UTF-8

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 22 14:52:05 PDT 2015


On 22.10.2015 21:13, Nordlöw wrote:
> Hmm, why isn't this already in Phobos?

I think parsing only Unicode escape sequences is not a common task. You 
usually need to parse some larger language of which escape sequences are 
only a part. For example, parsing JSON or XML are common tasks, and we 
have modules for them.

When we don't have a module for the language in question, then it's 
still likely that you need to parse more than just Unicode escape 
sequences. Some parseUnicodeEscapeSequence function would then probably 
not buy you much on the convenience side but cost you some on the 
performance side.

Also, since escape sequences are defined as part of larger languages, 
they are not well-defined by themselves. We could have a function that 
parses D style sequences, but strictly that would only be good for 
parsing D code.


More information about the Digitalmars-d-learn mailing list