Astronaut
Astronaut

Reputation: 7041

How to convert utf-8 to cp1252 in C#?

I need to convert a XML file that is being sent on utf-8 to cp1252. How is this possible?

My consumer application only support ANSI characters in it's controls and not Unicode. It also does a memcopy of the bytes received.

Upvotes: 1

Views: 1062

Answers (2)

Astronaut
Astronaut

Reputation: 7041

Got an anwser from jonp from TEAM XAMARIN - http://forums.xamarin.com/discussion/337/how-to-send-byte-encoded-as-ansi

It turns out "You need to add the West internationalization assemblies to your application.":

By default, Mono for Android only includes a limited list of collation tables and Encodings. In order to include additional data into your application, you can use the MandroidI18n property: West

Upvotes: 0

Robert H
Robert H

Reputation: 11730

Try the Encoding.Convert method. See here: http://msdn.microsoft.com/en-us/library/kdcak6ye(v=vs.100).aspx

Upvotes: 1

Related Questions