On Sunday, 1 April 2018 at 02:44:32 UTC, Uknown wrote:
If you want to stop auto-decoding, you can use std.string.representation like this:

import std.string : representation;
auto no_decode = some_string.representation;

Now no_decode wont be auto-decoded, and you can use it in place of some_string. You can also use std.utf to decode by graphemes instead.

.representation gives you an const(ubyte)[]

What you typically want is const(char)[], for this you can use std.utf.byCodeUnit

https://dlang.org/phobos/std_utf.html#byCodeUnit

There's also this good article:

https://tour.dlang.org/tour/en/gems/unicode

Reply via email to