File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes javascript unicode Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "javascript unicode" Watch "javascript unicode" New topic
Author

javascript unicode

Jay Richards
Ranch Hand

Joined: Jan 16, 2003
Posts: 58
hello everyone...
i know a lot of very good javascript coders here and im in dire need of yuor help...
im building a web application using struts... im placing all of my messages in a properties file.
anyway, one of my messages is formatted this way.

in my jsp file i put this in the alert function as

the this is it shows the text as is "판매품목" is diasplayed...
i did some i research and found out that it should be in the unicode format \uXXXX...
maybe someone could give me code to convert 판 strings to \u54032... basically removing "&#" in the front and ";" in the back...
thanks a lot...
chard
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
wouldn't it be easier to do this on the server side and not on the client side. The client side is not reliable and can be turned off so your code will not work on the browser.
basically if you want to do it on the client side then you need to look into replace() method with regular expressions....
general idea is here:

Eric
[ March 02, 2004: Message edited by: Eric Pascarello ]
Jay Richards
Ranch Hand

Joined: Jan 16, 2003
Posts: 58
thx..
i did try doing that but alert just wont show up the correct korean character...
i have this code that display correctly in my browsers

how can i display this in javascript in the correct format... i.e. actually korean characters.
pls help me out anyone...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
did you try just manually typing in \51333\47448\47749 and seeing if that shows up?
Do you have the meta tag to show the correct characterset?
Jay Richards
Ranch Hand

Joined: Jan 16, 2003
Posts: 58
i have the correct meta tags cause i can show the correct characters in the browser... what i need is to be able to show the same characters using javascript. the original string is in the &#xxxxx; format... i followed one of the advise to replace &# with \\u for unicode...
 
 
subject: javascript unicode
 
Threads others viewed
what is "function" here means ?
javascript and java
translate from English to Hindi
Changing ActionErrors to ActionMessages in struts application
Validate
developer file tools