mercredi 4 mars 2015

How should I limit the query length in this case (different character limitation for Chinese and English Writer)?

There is a <asp:textbox> for the user to input some query sentence (so the query might be long) in my web application. I put a limitation of the query length by adding attribute MaxLength="1024". When I took Chinese query in to consideration, things went complicated.



  • One Chinese character will be encoded into 9 ASCII characters (%xx%xx%xx in UTF-8).

  • IE browser location bar only supports 2083 characters.


So if the user enters 1024 Chinese characters, the URL will be at least 9216-characters-long. The URL will be truncated and the user is unable to bookmark this query.


In other words, I should support at max about 200 Chinese characters. If I use MaxLength="200", I feel this limitation is so strict for English writers.


How can I make best use of the 2083 limitation while providing good UX to have the user know how many characters (Chinese or English) he/she can input?


I don't want to use MaxLength="200" for Chinese writers and MaxLength="1024" for English writers.





Aucun commentaire:

Enregistrer un commentaire