开发者

convert from ascii (dos) to windows

Hi I have a string written in ascii code whose output i开发者_开发问答s " ”˜‰ƒ ‰™˜€" this is a name in Hebrew. How can I convert it to Hebrew letters? .net c# winform


There are no Hebrew letters in ASCII, so you have to mean ANSI. There is a default encoding for the system that is used for encoding ANSI, which you need to know to decode it.

It's probably the Windows-1255 or ISO 8859-8 encoding that was used. You can use the Encoding class to decode the data. Example:

Encoding.GetEncoding("ISO 8859-8").GetString(data);

If you already have a string, the problem is that you have decoded data using the wrong encoding. You have to go further back in the process before the data was a string, so that you can get the actual encoded bytes.

If you for example are reading the string from a file, you have to either read the file as bytes instead, or set the encoding that the stream reader uses to decode the file data into characters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜