C# How is ctrl+A input turned into a smiley?

While learning about Console.ReadLine() in depth, I found something very peculiar.

I wrote following code in Main method in a console application in C#

string str = Console.ReadLine();
Console.WriteLine(str);
Console.WriteLine(str.Trim());
Console.ReadLine();

When I ran the code, I gave input as ctrl+A and pressed enter. I see smileys (not able to post image, as I don't have permission to do it yet).

I want to understand, how is it showing the smiley? Shouldn't it show ^A or empty/blank (empty because when I tried debugging it, it showed string value a " ".)

Jon Skeet
people
quotationmark

The smiley is just how the console displays U+0001 (start of heading) - and that's the character that apparently is read as input from the console when you type Ctrl-A... a bit like the way that if you type Ctrl-G you get U+0007 (bell).

This isn't really .NET behaviour, so much as the Windows console behaviour (both input and output) - I can reproduce exactly the same behaviour in Java, for instance.

people

See more on this question at Stackoverflow