Link to home
Start Free TrialLog in
Avatar of Jerry_Pang
Jerry_Pang

asked on

Ascii to unicode

<script type="text/javascript">

Function ascii2unicode(text)
{
unicode= text
return unicode
}
</script>

=)

i want to convert the text to \u???? characters. (A points)

if thats possible. or replace any characters > 127 to "?"(B points) - (assited)

Having problem with unicode characters submmiting to my active x on a different language setings.
i figured i will need a javascript program that will convert any chinese/ñ special characters (ascii >127) to a ? character or convert it to a unicode text then my active x is good to go..

thanx. need info how
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada 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
Avatar of Jerry_Pang
Jerry_Pang

ASKER

this is what i need
thanx. just posting it here for my history questions.

function hexVal(char){
  decNum=char.charCodeAt(0)
  if ( decNum>127 ){
    hex=decNum.toString(10).toUpperCase();
   switch (hex.length){
    case 2:hex='&#'+'00'+hex + ';'
      return hex
    case 3:hex='&#'+'0'+hex + ';'
      return hex
    default :
      return '&#'+hex + ';'
   }
 }
 else
  return char
}