Frage

I have a string: ‰€‹†… ‰‰‰ ;

I want to display it in a textbox but with it's hebrew value .

I know for a fact that it is a hebrew string but something with the encoding set the result to the string you see.

How can I convert it in my Code so I can see it in hebrew.

I tried:

string a = " ‰€‹†… ‰‰‰ " ;
string b = " âìéåï " ; // this string works.
Encoding latinEncoding = Encoding.GetEncoding("Windows-1252");
Encoding hebrewEncoding = Encoding.GetEncoding("Windows-1255");
byte[] latinBytes = latinEncoding.GetBytes(a);
string hebrewString = hebrewEncoding.GetString(latinBytes);
textBox1.Text = hebrewString;

The thing is that if the string was b , it works. but all my strings are as a.

War es hilfreich?

Lösung

Your string is not encoded in windows-1255 encoding, it is encoded in code page 862, sometimes called MS-DOS Hebrew, so the code should be:

Encoding hebrewEncoding = Encoding.GetEncoding(862);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top