0

The o umlaut is 148 'ö' in ASCII, so why does

Encoding.ASCII.GetBytes("ö")

return

63 '?'

?

Jonas Sourlier
  • 13,684
  • 16
  • 77
  • 148
  • 4
    There is no 148 is ASCII. ASCII is 7-bit. – Thilo Jan 15 '15 at 11:25
  • 1
    ASCII does not have any values greater than 127 - you possibly might be thinking of the Windows-1252 character encoding? – Rowland Shaw Jan 15 '15 at 11:26
  • 1
    The question this is marked a duplicate of doesn't ask quite the same question, and, so, doesn't have a complete answer for part of what you asked: Why "?". The answer is the Encoding.ASCII class has its [EncoderFallback](http://msdn.microsoft.com/en-us/library/system.text.encoding.encoderfallback(v=vs.110).aspx) set to a EncoderReplacementFallback instance with "?" as the replacement character. You are free to create a similar Encoding with a different EncoderFallback behavior, such as an throwing an exception. I usually prefer to fail than to corrupt text. – Tom Blodget Jan 15 '15 at 21:02

0 Answers0