'windows-1255'不是受支持的编码名称 [英] 'windows-1255' is not a supported encoding name
问题描述
我在写一个silverlight 5应用程序,其中我需要从用户读取一个文本文件。
I'm writing a silverlight 5 application in which I need to read a text file from the user.
这里是我的代码片段:
using (StreamReader reader = new StreamReader(fileStream, Encoding.GetEncoding("windows-1255")))
但我得到例外:'windows-1255'不是支持的编码名称。
为什么?
But I get the exception: "'windows-1255' is not a supported encoding name". Why is that?
然后,如何读取windows-1255编码中的文件? (希伯来语)
And then, how do I read a file in the "windows-1255" encoding? (Hebrew)
推荐答案
我再次碰到这个问题,
经过大量的Googleing,我发现这个惊人的工具!
And after lots and lots of Googleing i found this amazing tool!
http://www.hardcodet.net/2010/03/silverlight-text-encoding-class-generator
这个由Philipp Sumi(@phsumi)创建的小艺术品,采用一个众所周知的编码的名称或代码页,并创建一个自定义的编码类
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.
这样做是通过读取wpf中的现有编码,并将其重新编译为在silverlight下工作。
it does so by reading the existing encoding in wpf, and redactor it to work under silverlight.
这篇关于'windows-1255'不是受支持的编码名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!