Unicode chars in functions

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

Hello,

I am trying find out a pretty way to handle unicode characters in
VBScript/ASP function.

The below code snippets spews error!

<%
Response.Charset="UTF-8"
Response.write "I am special ?"
Response.write chr("?")
%>

Any good workaround would appreciated

Thank you

Regards

Raj
 
J

Jon Wallace

Hi Raj,

You are using the chr() function incorrectly. The chr() function "returns
the character associated with the specified character code" whereas you are
passing it a character instead of an integer.

If you are wanting to get the character code, the function you want is asc()
which "converts the first letter in a string to ANSI code, and returns the
result".

Look here for information on the asc() function in VBScript (ASP) -
http://www.w3schools.com/Vbscript/func_asc.asp
.... and look here for information on the chr() function in VBScript (ASP) -
http://www.w3schools.com/VBscript/func_chr.asp

Hope this helps,
Jon

www.insidetheregistry.com
 
E

Evertjan.

Jon Wallace wrote on 10 apr 2009 in
microsoft.public.inetserver.asp.general:
You are using the chr() function incorrectly. The chr() function
"returns the character associated with the specified character code"
whereas you are passing it a character instead of an integer.

If you are wanting to get the character code, the function you want is
asc() which "converts the first letter in a string to ANSI code, and
returns the result".

Look here for information on the asc() function in VBScript (ASP) -
http://www.w3schools.com/Vbscript/func_asc.asp
... and look here for information on the chr() function in VBScript
(ASP) - http://www.w3schools.com/VBscript/func_chr.asp


AscW()

AscW is provided for 32-bit platforms that use Unicode characters. It
returns the Unicode (wide) character code, thereby avoiding the conversion
from Unicode to ANSI.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top