|
|
 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 18th, 2009, 06:08 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
codepage and UTF-8 on one page
Hi guys,
I'm Marianne, been programming in classic ASP for a year now and today, after googling for hours I'm getting a little desperate...
So, we have a SQL database. Some fields are in codepage and some in UTF-8.
I put
Code:
Response.ContentType = "text/html"
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
Response.CharSet = "UTF-8"
at the top and
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
further down in my <head>
I convert the CP strings to UTF8 using
Code:
Dim TextCodePageIndex : TextCodePageIndex = 1253 '(this could be another value)
set objConvert = server.createobject("C2U2C.clsConvert")
sWelcome = objConvert.CP2UTF8(TextCodePageIndex, sWelcome)
I get the one text I get directly in UTF-8 showing up properly, but the other texts are all messed up and look nothing like greek.
Then when I comment out the
Code:
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
at the top and
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
further down in my <head>, everything looks perfect except for the one string that was UTF-8 already.
Converting that bit of text doesn't do the trick either.
I can't convert it back to codepage first because this is data entered by users so I don't know what codepage to convert it to.
Any ideas?
|

June 18th, 2009, 04:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,319
Thanks: 3
Thanked 69 Times in 68 Posts
|
|
I dunno if it works with data from SQL Server, but you *could* try this:
Code:
Session.CodePage = 1253 ' or whatever
someVariable = RS("someFieldInCP1253")
Session.CodePage = 65001
anotherVariable = RS("someFieldInUnicode")
...
Used to work, 10 years ago, with MySQL database (and Access, I think...before Access went all Unicode). The recordset holds (held?) the data in raw database form and the assignment to the variable used the appropriate MBCS conversion, if needed.
A stab in the dark, and ancient technique. Good luck.
|

June 19th, 2009, 06:52 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Old Pendant, I will give it a go next time me and CodePage will cross paths 
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Codepage 1252 (Western) Issue? |
tclotworthy |
XSLT |
5 |
March 2nd, 2007 01:43 PM |
| Codepage |
minhtri |
Classic ASP Professional |
1 |
April 20th, 2005 05:16 AM |
| CODEPAGE="1252" |
crmpicco |
Javascript |
2 |
January 27th, 2005 10:22 AM |
| Codepage |
kochoo |
Classic ASP Basics |
1 |
April 24th, 2004 02:28 AM |
| Codepage Problem? |
birdcage |
Classic ASP XML |
2 |
October 21st, 2003 07:10 AM |
|
 |