?
Solved

VBScript Asc function not returning correct ASCII code for accented characters

Posted on 2013-07-01
2
Medium Priority
?
1,256 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:
sedgwick 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 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