'windows-1255' is not a supported encoding name

I'm writing a silverlight 5 application in which I need to read a text file from the user.

Here is a snippet of my code:

  using (StreamReader reader = new StreamReader(fileStream, Encoding.GetEncoding("windows-1255")))

But I get the exception: "'windows-1255' is not a supported encoding name". Why is that?

And then, how do I read a file in the "windows-1255" encoding? (Hebrew)


There are not many supported encodings in Silverlight. Basically, you get UTF8 and UTF16, see http://msdn.microsoft.com/en-us/library/t9a3kf7c%28VS.95%29.aspx

You can read your file as binary then convert yourself to UTF (8 or 32, I don't know Hebrew). You'll need a table of all the characters (256), then you can loop on your input file and translate directly.

i ran into this problem again,

And after lots and lots of Googleing i found this amazing tool!


this little piece of art that was created by "Philipp Sumi (@phsumi)", takes the name or code page of a well known encoding, and creates a custom Encoding class which compiles under Silverlight.

it does so by reading the existing encoding in wpf, and redactor it to work under silverlight.

Need Your Help

Storing properties of objects in C#/WPF

c# .net wpf properties

I'm allowing user to drag/drop some objects from a toolbox and of course each object has a unique id. As soon as object is used, let's say placed on a grid or canvas, I need to show its properties ...

Expected Moves vs Copies

c++11 destructor move copy-constructor

It is my understanding that move semantics can use move-constructors to elide what would otherwise be a copy. For example, a function returning a (perhaps) large data structure can now return by v...