I get a stream in UTF8 format, But i would like to get it in UTF16 format as i get some unsupported international characters in C#. How do i achieve this
Asked
Active
Viewed 1,715 times
-1
-
Which "*unsupported international characters*" did you get in C#? – Lion Jun 28 '12 at 18:51
-
3UTF-8 can represent every unicode character, so I'm not sure what changing the represenation to UTF-16 would achieve. – dlev Jun 28 '12 at 18:51
-
2Could you show us your code? The likelihood is that your stream is not really UTF-8. – Douglas Jun 28 '12 at 18:52
-
Were you able to represent those international characters in UTF-16? – C.Evenhuis Jun 28 '12 at 20:35
1 Answers
0
If you get unsupported international characters the encoding you'd likely want to use is not UTF16
but: iso-8859-1
It correctly encodes characters such as: æ, ø, å
So when you declare your StreamReader
you'd want to setup the encoding to use:
var sReader = new StreamReader(hResponse.GetResponseStream,
Encoding.GetEncoding("ISO-8859-1"));
Hope this helps.

Chris Piechotta
- 96
- 1
- 4