javascript toUpperCase() giving problem for utf-8

for UTF-8 i am using encodeURIComponent method ;its working fine for all cases except  some characters like alt159 when i use javascript toUpperCase() its coming box character

encodeURIComponent(document.getElementById("XXXXX").value.toUpperCase())
LVL 20
chaitu chaituAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ZvonkoConnect With a Mentor Systems architectCommented:
And also here you can adapt the return values in the toUpper() function to what you need:

<script>


function toUpper(theStr){
  return theStr.replace(/[a-z]/g,function(p){return p.toUpperCase()});
}


alert(toUpper("Zvonko"));
</script>

0
 
REA_ANDREWCommented:
Have you confirmed that these characters do have UPPER CASE variations, as doing this would result in the systems returning a Square Character as your request is invalid. i.e. what is the UPPER CASE alt code for alt159

Andrew
0
 
REA_ANDREWCommented:
FOr validation purposes, you could apply an onblur event or onkeyup, which would perform a Replace on a range on Alt Codes in the Target Value. Meaning that when you come to perform the toUpperCase method, no character is there that you are unprepared for. A lit of these ranges can be found here

http://www.tomwilson.com/david/accents/Alt_key_chars.doc
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
chaitu chaituAuthor Commented:
when i enter alt159 it will come as ƒ;
when user enter any characters i am converted into upperCase.when user entered above special character also i am doing same thing;then its giving problem.that special character turns into square bracket.at that time what is the remedy
0
 
chaitu chaituAuthor Commented:
i am not doing validation;i am preparing url here in javascript and send it to another page;
0
 
chaitu chaituAuthor Commented:
"hich would perform a Replace on a range on Alt Codes in the Target Value"

how can i perform a  a Replace on a range on Alt Codes ??
0
 
chaitu chaituAuthor Commented:
first tell me Is alt159 is special character or UTF character
0
 
ZvonkoSystems architectCommented:
Is this now answered too?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.