Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

UTF8 with alert of Javascript

Posted on 2006-03-24
5
Medium Priority
?
596 Views
Last Modified: 2008-02-01
Hello

I get some value "Russia" from my file RessourceBundle
and I have a UTF8 string following

<script language='javascript'>
var MSG_INVALID = "&#1042;&#1099; &#1074;&#1074;&#1077;&#1083;&#1080; &#1085;&#1077;&#1087;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1077; &#1089;&#1080;&#1084;&#1074;&#1086;&#1083;&#1099; &#1074; %0.\n&#1042;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077; &#1076;&#1088;&#1091;&#1075;&#1080;&#1077; &#1089;&#1080;&#1084;&#1074;&#1086;&#1083;&#1099;"
</script>

when I alert : alert(MSG_INVALID), it don't display like unicode
I know we can use
  alert(String.fromCharCode(1042,1099,1074,1074, ......));
or we can use the hidden input of form to stock this value
but I dont know there are another solutions for this?

thanks a lot
best regards
0
Comment
Question by:ndhai
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16279374
Or a hidden div, which is what I would use if no-one has a good solution

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Untitled</title>
<script>
function alertIt(replacement) {
  var x = document.getElementById('rusmsg').innerHTML;
  x=x.replace('%0',replacement).replace('\\n','\n')
  alert(x)
}  
</script>
</head>

<body onLoad="alertIt('Error 3')">
<div id ="rusmsg" style="display:none">&#1042;&#1099; &#1074;&#1074;&#1077;&#1083;&#1080; &#1085;&#1077;&#1087;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1077; &#1089;&#1080;&#1084;&#1074;&#1086;&#1083;&#1099; &#1074; %0.\n&#1042;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077; &#1076;&#1088;&#1091;&#1075;&#1080;&#1077; &#1089;&#1080;&#1084;&#1074;&#1086;&#1083;&#1099;</div>


</body>
</html>
0
 

Author Comment

by:ndhai
ID: 16318418
thanks for your reponse but it likes my method
i think we haven't no choice with String.fromCharCode
admin, could you close this question ?
thanks
ndhai
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16319260
Please ask here http://www.experts-exchange.com/Community_Support/ for a paq/refund
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16353476
Closed, 80 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question