Is it possible to add a copyright symbol or other "special" symbol in any way in a C# console application?
+9
A:
namespace test {
class test {
public static void Main() {
System.Console.WriteLine("©");
}
}
}
works for me flawlessly. Regardless of whether the console window is set to raster fonts or Unicode.
If you want to output Unicode, you should set the console output encoding to UTF-8.
And if you want to stay clear from source code encoding issues you should specify the character code point directly:
System.Console.WriteLine("\u00a9");
Joey
2009-03-13 22:08:25
Thanks. It seemed all to strange to me that that would be an acceptable way of using "special" symbols. Guess C# can handle it. :)
Patrik Björklund
2009-03-13 22:11:19
You can even use some special characters like ä, ö, ü or so in variable identifiers. Or greek :). If you are using a special codepage for source, you may need to specify /codepage:n for csc. UTF-8 encoding with ZWNJ at the start works without a hitch in any case, though.
Joey
2009-03-13 22:13:50
+9
A:
You can copy it from here if you like:
©
(You can hold down ALT, then type 0169, then release the ALT key)
Mark Ingram
2009-03-13 22:08:25
+2
A:
Console.WriteLine("©");
works for me...
Or isn't it output you're after?
PHeiberg
2009-03-13 22:10:42
+2
A:
How about holding down ALt and typing 0169 to get the copyright symbol.
static void Main(string[] args)
{
Console.Write("©");
}
tyndall
2009-03-13 22:10:53