2

I have the following line of code for a Windows forms application:

return Encoding.ASCII.GetBytes(chars.ToArray());

This line worked fine, but today I was trying my code on the Windows Phone/Silverlight framework and the:

Encoding.ASCII 

Library does not exist there. Is there any (simple) way to do the same thing but with a Silverlight library?

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
Bart Teunissen
  • 1,420
  • 5
  • 20
  • 43
  • 1
    Have a look at http://stackoverflow.com/questions/4022281/asciiencoding-in-windows-phone-7 – gbanfill Apr 04 '12 at 12:16
  • 1
    Did you see [this](http://stackoverflow.com/questions/4022281/asciiencoding-in-windows-phone-7) solution? It looks like there is an easy way to achieve it. cheers, – josemiguel.torres Apr 04 '12 at 13:00

2 Answers2

5

Try using Encoding.UTF8 - Silverlight is unicode only.

Chriseyre2000
  • 2,053
  • 1
  • 15
  • 28
0

Probably using Encoding.UTF8 will solve your problem, but you can always use the Silverlight Encoding Generator and get any encoding you'd like!

Pedro Lamas
  • 7,185
  • 4
  • 27
  • 35