January 11, 2019 Print a copyright symbol | ||||
---|---|---|---|---|
| ||||
How would I use writeln to print a copyright symbol to the console? I have tried using the unicode code \u00A9, as well as embedding the symbol directly in the string, but I just get garbage when I run it. |
January 11, 2019 Re: Print a copyright symbol | ||||
---|---|---|---|---|
| ||||
Posted in reply to Head Scratcher | On Friday, 11 January 2019 at 16:48:40 UTC, Head Scratcher wrote:
> How would I use writeln to print a copyright symbol to the console? I have tried using the unicode code \u00A9, as well as embedding the symbol directly in the string, but I just get garbage when I run it.
You need to be using a system that supports the output.
On Windows, it means changing the console mode to utf-8 so it understands the bytes when it sees them.
import core.sys.windows.windows;
SetConsoleOutputCP(65001); // UTF-8
before you do some writeln and it should work on windows 10. On older systems, you might have to go into console properties and select a truetype font too.
(or as the user btw you can go into console properties and change the code page there, but I think it is slightly easier to do it on code)
|
Copyright © 1999-2021 by the D Language Foundation