开发者

C# Writing Hebrew to a db the text is written left to right e.g. olleh not hello

开发者 https://www.devze.com 2022-12-24 18:22 出处:网络
When writing Hebrew to a dat开发者_JAVA技巧abase the text is being written left to right when it should be right to left, as Hebrew is written right to left, my app is writing \"hello\" and it should

When writing Hebrew to a dat开发者_JAVA技巧abase the text is being written left to right when it should be right to left, as Hebrew is written right to left, my app is writing "hello" and it should be writing "olleh" (in Hebrew of course).

To read the Hebrew into my app I use System.Text.Encoding.GetEncoding(1255);

The text displays correctly in my app but when written to the database it is written left to right. My question is what am I missing when writing the text to the db?

Many thanks Jonathan


Codepage 1255 encodes the text in logical, not visual order. Since you said it displays correctly in your app but not in your database, the most likely explanation is that the database tool does not support bidirectional text when you query it interactively. That does not matter, since the users don't directly query the database. Your app does, and then properly displays the bidirectional text.


Is your database set up with a sort order/collation that is right-to-left? For example, SQL Server sort order 138 = Dictionary order, case-insensitive, for use with the 1255 (Hebrew) character set.


Try with this encoding Encoding.UTF8; Encoding.GetEncoding("iso-8859-8");

0

精彩评论

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