开发者

Textbox.Text displays properly, but I am not getting correct Japanese characters on server code

I'm able to type Japanese characters into the textbox, an开发者_C百科d it displays well. However, when I click on the Save button, I view the text property of the textbox and its value is weird, such as 'テルからイ'

This is the value being sent and stored in the database. How do I get the normal Japanese characters that's being displayed in the textbox?


What's going on is encoding and decoding. You can go to an online decoder to see what the characters you showed really look like. So, 無料延泊

becomes

無料延泊

You can do the decoding in JavaScript (before you save to the database) either using the string class in prototype or some inbuilt JavaScript methods or see Stack Overflow question How to decode HTML entities using jQuery?. Or you can decode on the server in C# using Html.Decode.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜