Need understanding as to why string.StartsWith() is true when it should be false

asked4 years ago
last updated4 years ago
viewed518 times
Up Vote17Down Vote

So I have this file that I download via ftp. The file is just a config file for a system at my company I work for. Once the file is downloaded I open the file and processor the file. Part of the processing of the file is to check to see if a line starts with a Unicode character \u001a. This is where I am stumped because .StartsWith("\u001a") is always true, yet I cannot see why. If I view the file in Notepad++ or in a hex editor, I just don't see that. So there is something I am missing here. Here's a minimal example (fiddle):

// prints True in .NET 5
Console.WriteLine("Hello".StartsWith("\u001a"));