Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Internationalization query

 
shalu sharma
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a novice in Internationalization API, i am working in a project which is to internationalize the site in multi-byte simplified chinese text.

I am trying to write a code for validation of a text area box where the user would be entering in chinese language. My code should check the maximum no of characters that a user can enter let's say the upper limit is fixed to 3000 chinese language characters.

Now I am not able to understand how can this be done, i mean which API in java supports such thing, does simply reading bytes solves this ?

I also have to perform a client side javascript validation for same. Does javascript supports internationalization ?

Thanks
Shalu
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you textbox at the time of submission displays only the final chinese characters, then Java basically represents each one of these characters as a single char (of some unicode value up in the chinese region.) Thus, a simple, str.length() should work.

Let us know if this works.
[ December 20, 2005: Message edited by: Stuart Ash ]
 
shalu sharma
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stuart Ash:
If you textbox at the time of submission displays only the final chinese characters, then Java basically represents each one of these characters as a single char (of some unicode value up in the chinese region.) Thus, a simple, str.length() should work



Stuart,

yes my textarea would be displaying the final chinese characters only at the time of form submittal. I have one doubt, these simplified chinese characters takes more space as compared to english ie some of them takes 2 bytes some 3 bytes. Also when I write these charcters on my text area i am able to write about 30 characters on a avergae per line.

So does it mean that I have to increase the rows and cols of the text area as the upper limit should be same as that of english character. I just wanted to understand is this the approach being followed in other chinese sites also. As a matter of fact, I looked at yahoo china, but there the look and feel is almost the same as yahoo india or yahoo US.

Does u have any idea how can I validate the chinese character in javascript, let's say I do not want the chinese equivalent of ; and ! not to be entered by the user. how can this be achieved ?

I hope I haven't confused you..

Thanks
Shalu
 
shalu sharma
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey no replies .. still waiting ..
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shalu sharma:



Stuart,

yes my textarea would be displaying the final chinese characters only at the time of form submittal. I have one doubt, these simplified chinese characters takes more space as compared to english ie some of them takes 2 bytes some 3 bytes. Also when I write these charcters on my text area i am able to write about 30 characters on a avergae per line.

So does it mean that I have to increase the rows and cols of the text area as the upper limit should be same as that of english character. I just wanted to understand is this the approach being followed in other chinese sites also. As a matter of fact, I looked at yahoo china, but there the look and feel is almost the same as yahoo india or yahoo US.


I hope I haven't confused you..

Thanks
Shalu


I hope too

"bytes" don't equate to "space." A single chinese character, say 中, will need two or three bytes in the encoding system, but will take up just one "unit of space" on a PC display. That is if you write 5 chinese characters and five Roman characters (abc...) on two successive lines using a monospace font, they would occupy the same space.

So, you decide whether to look at character count or byte count - they are different.
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to demonstrate the char spacing example here, not sure if it displays on your PC.




The third one is Japanese.
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stuart Ash:
I am trying to demonstrate the char spacing example here, not sure if it displays on your PC.




The third one is Japanese.



I think I am wrong, about the character spacing. Any Chinese person here to add light?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic