Unicode exception raise when replacing underscore with space

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 13 05:01:38 PST 2015


V Tue, 13 Jan 2015 12:32:15 +0000
"Nordlöw" via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
napsáno:

> I get
> 
>      core.exception.UnicodeException at src/rt/util/utf.d(290):
> 
> in a call to
> 
>      std.string.tr(x, `_`, ` `)
> 
> for a badly encode string x. Is it really needed to do 
> auto-decoding here?
> 
> Isn't the encoding of underscore and space uniquely one by byte 
> in UTF-8?
> 
> What do I need to do/add to avoid auto-decoding here?

std.array.replace(x, `_`, ` `);



More information about the Digitalmars-d-learn mailing list