Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBScript Asc function not returning correct ASCII code for accented characters

Posted on 2013-07-01
2
Medium Priority
?
1,270 Views
Last Modified: 2013-07-01
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:

	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 />"

Open in new window


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?
0
Comment
Question by:mike99c
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 39289737
try AscW() instead of Asc()
0
 

Author Comment

by:mike99c
ID: 39289761
That did the trick, thanks a lot, I had never come across this function before.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

610 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