what's the correct way to handle unicode? - trying to print out graphemes here.

Adam D. Ruppe destructionator at gmail.com
Tue Jul 3 14:37:32 UTC 2018


On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote:
> So basically the above just doesn't work. Prints gibberish.

What system are you on? Successfully printing this stuff depends 
on a lot of display details too, like writeln goes to a 
terminal/console and they are rarely configured to support such 
characters by default.

You might actually be better off printing it to a file instead of 
to a display, then opening that file in your browser or 
something, just to confirm the code printed is correctly 
displayed by the other program.

> foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈".byGrapheme) {
>   writeln(c.<????>);

prolly just printing `c` itself would work and if not try `c[]`

but then again it might see it as multiple graphemes, idk if it 
is even implemented.


More information about the Digitalmars-d-learn mailing list