Thread overview | |||||
---|---|---|---|---|---|
|
July 29, 2016 Dealing with unicode | ||||
---|---|---|---|---|
| ||||
I'm trying to add support for unicode to my app in D and having issues. string str = "Pokémon No"; writeln(str); this outputs: Pok├®mon No what I want to do is change the funky character such that the string reads: Pok\u00e9mon No as \u00e9 == é how can i do this in D? |
July 29, 2016 Re: Dealing with unicode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fabian | On 29/07/2016 6:32 PM, Fabian wrote:
> I'm trying to add support for unicode to my app in D and having issues.
>
> string str = "Pokémon No";
> writeln(str);
>
> this outputs:
> Pok├®mon No
>
> what I want to do is change the funky character such that the string reads:
> Pok\u00e9mon No
>
>
> as \u00e9 == é
> how can i do this in D?
Your terminal doesn't support utf-8.
Prints fine using dpaste and gnome-terminal.
|
July 29, 2016 Re: Dealing with unicode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fabian | On Friday, 29 July 2016 at 06:32:24 UTC, Fabian wrote:
> I'm trying to add support for unicode to my app in D and having issues.
>
> string str = "Pokémon No";
> writeln(str);
>
> this outputs:
> Pok├®mon No
>
> what I want to do is change the funky character such that the string reads:
> Pok\u00e9mon No
>
>
> as \u00e9 == é
> how can i do this in D?
Strings are UTF-8 in D - but the console might need to be configured to display them correctly. If you're on Windows, this will do it:
SetConsoleOutputCP(CP_UTF8);
|
Copyright © 1999-2021 by the D Language Foundation