diff options
Diffstat (limited to 'mcs/class/corlib/System.Text/ASCIIEncoding.cs')
-rw-r--r-- | mcs/class/corlib/System.Text/ASCIIEncoding.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Text/ASCIIEncoding.cs b/mcs/class/corlib/System.Text/ASCIIEncoding.cs index 282933c976e..d795c7937a8 100644 --- a/mcs/class/corlib/System.Text/ASCIIEncoding.cs +++ b/mcs/class/corlib/System.Text/ASCIIEncoding.cs @@ -239,11 +239,10 @@ public class ASCIIEncoding : Encoding int count = byteCount; while (count-- > 0) { - char c = (char) bytes [byteIndex++]; - if (c < '\x80') - chars [charIndex++] = c; - else - chars [charIndex++] = '?'; + char c = (char)(bytes [byteIndex++]); + if (c > 127) + c = '?'; + chars [charIndex++] = c; } return byteCount; } |