How to get the length of Japanese characters in Javascript?

FoettyQuego

New Member
I have an ASP Classic page with SHIFT_JIS charset. The meta tag under the page's head section is like this:\[code\]<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">\[/code\]My page has a text box (txtName) that should only allow 200 characters. I have a Javascript function that validates the character length, which is called on the onclick() event of my Submit button.\[code\]if(document.frmPage.txtName.value.length > 200) { alert("You have exceeded the maximum length of 200."); return false;}\[/code\]The problem is, Javascript is not getting the correct length of Japanese character encoded in SHIFT_JIS. For example, the character
 
Back
Top