ISO-8859-2 Encoding on Windows Phone 8.1

252 views Asked by At

I'm writing a small RSS reader for a Hungarian site, which uses ISO-8859-2 for encoding.

Neither the RSS header nor the Content-Type header defines the encoding, so I'd like to set it manually. The only issue is, HttpClient won't let me.

If I use HttpClient.GetStringAsync(URI), it returns the string in UTF-16 encoding, which screws up the special characters (no conversion, just dumping it into the UTF-16 expecting String container).

If I use HttpClient.GetByteArrayAsync, then try to process it with XElement.Load(Stream), I get a weird error about not being able to encode ISO-8859-2 on the device, as it is not supported.

This is a Universal App, so I have a W8.1 counterpart too - which works flawlessly with the exact same code.

Is there any solution to do the conversion on WP8.1 too?

0

There are 0 answers