www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Print a copyright symbol

reply Head Scratcher <filter stumped.com> writes:
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.
Jan 11
parent Adam D. Ruppe <destructionator gmail.com> writes:
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)
Jan 11