开发者

how to convert Russian string to Cyrillic?

im using one search concep开发者_StackOverflow中文版t in my application, if the user enters the search key word as russian text it throws an exception..asp.net, c#..

Eg:-

If i enterd this string it throws an exception "сoгласoвания" (Russian text), so i converted the text into like this

" ñoãëàñoâàíèÿ ", now it works..

in html we can do this with the help of meta tag

meta http-equiv="content-type" content="text/html;charset=UTF8"

i dont know how to do in c#....

Please help me..

thanks in advance.


Using this site, I messed around with the text and got the original. It's encoded as widnows-1251 although there are other encodings that work. (windows-1254, windows-1252, iso8859-1, iso8859-9 and others)

In short, if you want to get the same output as the meta tag, encode it with the Encoding class (as mentioned by Vlad) initialized like this:

Encoding encode = new Encoding("windows-1251");


Surely you need Encoding class to change the encoding. Look up the example at the end of the MSDN article.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜