Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2004, 05:37 PM
Authorized User
 
Join Date: Jul 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting Unicode to Character

How do you convert Unicode into a character using ASP? The first two examples result in syntax errors. The third example prints the characters in the string.

ASPACE = Chr(\u00A0)
ASPACE = ChrW(\u00A0)
ASPACE = "\u00A0"

I do realize

ASPACE = Chr(160)

works but I’d also like to be able to work with Unicode.

Thanks,

Robin



 
Old August 6th, 2004, 09:05 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try ChrW(Replace("u00A1","u","&H"))
 
Old August 6th, 2004, 09:06 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry mistyped ChrW(Replace("u00A0","u","&H"))
 
Old August 6th, 2004, 11:31 AM
Authorized User
 
Join Date: Jul 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yehuda,

Thanks so much for the simplicity of your response. The Microsoft Library says to use WideCharToMultiByte to convert a Unicode string to an ANSI string. This function has 8 parameters and 3 include files.

Where did you find the solution you posted or did you come up with it yourself?

Robin

 
Old August 6th, 2004, 11:40 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Robin,

Its a pretty simple solution. &H denotes to vb that the next part of the string is a Hexidecimal number. I double checked this on google by doing a group search on converting hex in VB. That being said and knowing that the unicode character string you mentioned is hexidecimal all I did was change it to a string VB recognizes as hexidecimal, which will be recognized as a number by ChrW. I am glad I could lend a little guidance as I see it as giving back some of the guidance that was given to me when I started out (and indeed here and there I still find myself going to the news group for an issue that I am having trouble with).

Yehuda





Similar Threads
Thread Thread Starter Forum Replies Last Post
Character to Unicode entities Pankaj C XSLT 2 February 15th, 2008 08:59 AM
Get UNICODE or ASCII Value of a character Eyob_the_pro C# 0 January 10th, 2007 03:42 AM
Unicode translation using [xsl:output-character] ROCXY XSLT 5 May 15th, 2006 12:19 PM
Converting an ASCII character to binary? skyraider Visual Basic 2005 Basics 0 May 7th, 2006 08:20 PM
Converting from character to smalldatetime x_ray SQL Server 2000 2 November 26th, 2005 06:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.