mike99c
asked on
VBScript Asc function not returning correct ASCII code for accented characters
I am trying to convert some characters to ASCII code using the VBScript Asc function but the accented characters are giving incorrect negative values.
Take a look at this example:
The output is:
Ascii a (small a): 97
Ascii á (small a with acute): -15455
Ascii ä (small a with diaeresis): -15452
But I was expecting:
Ascii a (small a): 97
Ascii á (small a with acute): 225
Ascii ä (small a with diaeresis): 228
Am I missing something here and does the Asc function only work on non accented characters?
Take a look at this example:
response.write "Ascii a (small a): " & Asc("a") & "<br />"
response.write "Ascii á (small a with acute): " & Asc("á") & "<br />"
response.write "Ascii ä (small a with diaeresis): " & Asc("ä") & "<br />"
The output is:
Ascii a (small a): 97
Ascii á (small a with acute): -15455
Ascii ä (small a with diaeresis): -15452
But I was expecting:
Ascii a (small a): 97
Ascii á (small a with acute): 225
Ascii ä (small a with diaeresis): 228
Am I missing something here and does the Asc function only work on non accented characters?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER