Crash in byCodeUnit() <- byDchar() when converting faulty text to HTML

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 16 03:02:14 PDT 2014


On Sunday, 15 June 2014 at 23:09:24 UTC, Nordlöw wrote:
> Is this intentional?
>
> utf.d on line 2703 is inside byCodeUnit().

AFAIK, no. You hit an Error, and those shouldn't occur unless you 
go out of your way for them.

I'll look into it.

> When I use byChar() i doesn't crash but then I get incorrect 
> conversions.
>
> Could somebody explain the different between byChar, byWchar 
> and byDchar?

What's there to say? They all take a range of characters, and 
return it as a range of the corresponding requested type.

In the case of "byDchar", it decodes the string (while returning 
a "BadChar") for invalid encodings.

The others first decode using "byDchar", and then re-encode the 
individual dchars into the corresponding requested char-type.


More information about the Digitalmars-d-learn mailing list