Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Unicode, SQL and ASP

Author  Topic 

cpringle
Starting Member

2 Posts

Posted - 2005-03-08 : 08:27:45
Hello All,

I'm having a bit of a nightmare with unicode, ASP and SQL Server. I need to be able to put unicode characters into my database, however I can't get it to work.

My table consists of a number of ntext fields. My ASP has the codepage set to 65001 like so:
<% @codepage="65001" Language = "VBScript" %>

I've also made sure I've prefixed all my data with an 'N' to tell SQL server its unicode e.g.
"N'" & ldapRequestorNTLogon) & "', "

However, whenever my application writes to the database, I always see two characters for each non-latin character (from SQL Server Enterprise Manager). Shouldn't I see the unicode character if the field is of an ntext type? Also, when I read the data back out with a different application (not ASP), it comes out as two characters.

Have I got my understanding mixed up, or should I see the unicode characters appear in SQL Server Enterprise Manager. If I should, why am I not seeing unicode characters?

I've read the articles on MS's web site with regards to UCS-2, UTF-8, SQL Server and ASP, but I thought setting the codepage to 65001 should have sorted that...

Any help would be very much appreciated!!!

Regards,
Chris Pringle

SamC
White Water Yakist

3467 Posts

Posted - 2005-03-08 : 13:53:17
Ah Grasshopper

I can't put my finger exactly on your problem, but here are a few surprises I ran into that might help.

Sounds like you have the key elements right. codepage 65001 is required, as is UTF-8 (or some other meta tag).

You don't mention it, but you have the necessary language options installed in windows I presume. Asian language pack, regional language settings, control panel?

Here is a surprise. I had everything running fine for weeks, when a page stopped rendering UNICODE in the HTML. What was wrong? I had to load the ASP page in Notepad, and save it as UNICODE, FTP it back to the website. Voila! It was working again. I could not belive this was another hidden requirement. If you don't think so, take one of your working pages and save it as ANSI. It's scary how you can't tell when editing the file.

What editor are you using for your ASP pages?

Sam
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-03-08 : 13:54:22
When you query your data in Query Analyzer, does it display properly?
Go to Top of Page

cpringle
Starting Member

2 Posts

Posted - 2005-03-10 : 05:40:48
Hi Sam,

Thanks for the reply. I've looked into this further and it seems that it's a product called aspSmartUpload that is causing the problem. Although it appears to support unicode for file names, I'm not sure it supports unicode for the form elements. This is a really big problem as I need a tool that is free for commercial use, is able to support file uploads and also supports unicode! Nightmare!

If only this was a Unix system it would be so easy.....

Any suggestions for other tools/workarounds would be much appreciated!

Cheers,
Chris
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-03-10 : 10:08:05
quote:
Originally posted by cpringle

If only this was a Unix system it would be so easy.....
Why don't you confirm your thought about aspSmartUpload? Give them an email or a call.
Go to Top of Page
   

- Advertisement -