Default C# String encoding -


i having issues default string encoding in c#. need read strings files/packets. however, these strings include characters 128-256 range (extended ascii), , of these characters show question marks , instead of proper character. example, when reading string ,it come "s?mestr?n?" if string contained extended ascii characters.

now, there way change default encoding application? know in java define default character set command line.

there's no 1 single "extended ascii" encoding. there lots of different 8-bit encodings compatible ascii bottom 128 values.

you need find out encoding files actually use, , specific when reading data streamreader (or whatever else you're using). example, may want encoding windows-1252:

encoding encoding = encoding.getencoding(1252); 

.net strings always sequences of utf-16 code points. can't change that, , shouldn't try. (that's true in java well, , shouldn't use platform default encoding when calling getbytes() etc unless that's really, mean.)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -