Younger brother recently in learning to use ZK technology, found that the text filled in the textbox to produce odd Chinese characters garbled problem, no positive solution, all day unhappy ....
Odd character garbled problem produced by: ZK Ajax submitted in the TextBox in Chinese using UTF-8 urlencode encoding, passed to the server and then adopted GBK UrlDecode, it will produce this problem.
Online said to fill a full-width space, found that if mixed with Chinese characters English is not good, so I used a more awkward approach:
<textbox visible= "false" id= "Nickname2" width= "150px"/> <textbox action= "onblur:#{nickname2}.value=#{ Nickname}.value;#{nickname}.value=encodeuri (#{nickname}.value); Action.show (#{nickname2}); Action.hide (#{ Nickname}); "Id=" nickname "value=" "width=" 150px "/>
Define 2 textbox, one hidden, one display, the first to display the textbox to enter the Chinese characters nickname, put another hidden nickname2, but the input of Chinese characters finished, focus removal, triggering the onblur JS event, The contents of the nickname in the Nickname2, and the contents of the nickname with JS URL code, and then the nickname hidden
When submitted, the contents of the nickname are submitted to the server, and the server decodes the content.
Although this method to solve the garbled problem, but it is very awkward, hope to get the solution of the friend can sue ... A lot!
Put a system screenshot with ZK::
---------------
Supplemented, after a period of use, found that if returned to nickname to edit, will cause the edit invalid, therefore, the supplementary method is:
<textbox rows= "5" cols= "action=" "onfocus:#{content2}.value=" #{content}.value=decodeuri (#{content}.value); Action.show (#{content}); Action.hide (#{content2}); "Visible=" false "id=" Content2 "width=" 150px "/>
<textbox rows= "5" cols= "action=" Onblur:#{content2}.value=#{content}.value;#{content}.value=encodeuri (#{ Content}.value); Action.show (#{content2}); Action.hide (#{content}); "id=" Content "value=" "width=" 150px "/>
Get the focus and then decode it back.
Another thing to add is that if you put a textbox in a form, it can cause action.show action.hide to be ineffective, not knowing why, and avoiding it.