tags:

views:

1651

answers:

4

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
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
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
+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
I'm intrigued as to why someone downvoted this...
Mark Ingram
+1 from me. I love the ALT trick.
JaredPar
+2  A: 
Console.WriteLine("©");

works for me...

Or isn't it output you're after?

PHeiberg
+2  A: 

How about holding down ALt and typing 0169 to get the copyright symbol.

    static void Main(string[] args)
    {
        Console.Write("©");
    }
tyndall