3

In Windows, I can use the Encoding.GetEncoding ("Windows-1252") via .NET to retrieve the "Windows-1252" code page encoding. Unfortunately, this call throws an ArgumentExtception in Windows Phone 8 emulator, specifying that the encoding name is not valid. I looked around MSDN but didn't find anything useful. Does anyone know about which encodings are available in Windows Phone 8 and which is the new name of the "Windows-1252" encoding?

And yes, I am aware of the alternative option of using the "iso-8859-1" encoding and manually substituting the characters in the 129-159-range. But I'm trying to avoid that if possible.

Many thanks, Michael

Michael
  • 446
  • 4
  • 7
  • The only documented supported encodings are Unicode encodings. I supposed 8859-1 squeaked in because it is still common in web pages. – Hans Passant Jan 01 '13 at 17:24

3 Answers3

5

I am not sure this still works but remember it was useful. This tools generates the source code for a single byte code pages

http://www.hardcodet.net/2010/03/silverlight-text-encoding-class-generator

I hope the generated source works in windows phone subset of the base class library.

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106
3

As the exception message so clearly told you, the framework subset on Windows Phone doesn't come with support for Windows-1252. As you say, using Latin-1 (ISO-8859-1) is a way to do it.

Alternatively you can implement the encoding manually, which I wouldn't recommend.

Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150
-1

How about trying MultiByteToWideChar(Win32 API)?

Sample code is here.

http://bluewatersoft.cocolog-nifty.com/blog/2012/12/windows-phone-8.html

http://code.msdn.microsoft.com/wpapps/Windows-Phone-8-Shift-JIS-7ecd59fe/sourcecode?fileId=72228&pathId=1378915520

This is a samplle for CP-932(Shift JIS). Create a new "Windows Phone Runtime Component"(C++) project, then copy the code. Change the constant "CP_SJIS" for you, please.

In addition, I don't know whether CP-1252(Windows-1252) is effective on WP8.

biac
  • 247
  • 1
  • 4