Japanese characters and Javascript
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mayank_Jain
Posted On:   Thursday, September 12, 2002 04:56 AM

Japanese Characters and Javascript Hi, I have got an html page which has a textarea. Now I need to validate the no of bytes entered in this textarea by the user. Is there any way in javascript that i can do this? Initially, I was validating this using the length property. This works fine when normal english characters are entered. The problem is coming when I am trying to enter some japanese characters. Since japanese characters are multi-byte characters, I am getting the wrong value of no of bytes from the length property. This is a sample code I am using right now. function validate(){ alert(document.forms["form1"].elements["te   More>>
Japanese Characters and Javascript

Hi,


I have got an html page which has a textarea. Now I need to validate the no of bytes entered in this textarea by the user.

Is there any way in javascript that i can do this?

Initially, I was validating this using the length property.

This works fine when normal english characters are entered.

The problem is coming when I am trying to enter some japanese characters. Since japanese characters are multi-byte characters, I am getting the wrong value of no of bytes from the length property.


This is a sample code I am using right now.

			

















Now I am entering the following text in japanese.

‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨

On clicking on "validate" it is returning me 10 whereas the actual no of bytes in the above string is 20.

Can somebody help me out in this.

Thanks in advance.

Mayank    <<Less

Re: Japanese characters and Javascript

Posted By:   eimi_nos  
Posted On:   Thursday, September 12, 2002 05:33 AM

I do not know well about Javascript, but I can say that with character set "Shift JIS", Japanese characters are displayed properly here.
About | Sitemap | Contact