There are probably some non-printing unicode (or possibly low ASCII) characters in the end of the string. The console has a different encoding, and will often render such as ?
. Basically: use the indexer (yourString[n]
) or yourString.ToCharArray()
to investigate what is actually in the string aroung the location of the ?
.
With the edit, we can see that the string has a zero-width space (decimal 8203) at the start: