Link to home
Start Free TrialLog in
Avatar of chaitu chaitu
chaitu chaituFlag for India

asked on

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())
Avatar of REA_ANDREW
REA_ANDREW
Flag of United Kingdom of Great Britain and Northern Ireland image

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
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
Avatar of chaitu chaitu

ASKER

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
i am not doing validation;i am preparing url here in javascript and send it to another page;
"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 ??
first tell me Is alt159 is special character or UTF character
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is this now answered too?