Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: inserting unicode data into SQL 7 via web forms


Message #1 by ray@j... on Wed, 11 Oct 2000 20:46:21 +0100
My setup:

Server:

Windows 2k server

IIS 5

Accessing SQL Server 7 on an NT4 machine via a connect string in ASP



all installs are english standard versions.



I am trying with NO success to insert data into my SQL server 7 database

as UNICODE.  I have a web page with defined as charset=UTF-8 and has

several text form elements.  In my asp code I set the codepage = 65001 and

that is supposed to convert all the UTF-8 data to UCS-2 right???  well

it's not working on the way in... but it seems to be working on the way

out.  If i paste some chinese text into the form and insert it all i get

are a bunch of ?'s in the db.  I thought at first.. well it's ?'s cause i

dont have chinese SQL 7 so lets see if it comes out fine... so i have an

ASP app that set the codepage to 65001 and gets the data from SQL 7...  it

displays as a bunch of ?'s !!!  So basically i know it's not working. 

Now... if i insert RAW UTF-8 data the same app will CONVERT is again on

the way out... so it seems like it is converting on the way out.. BUT i

cant get valid UCS-2 data into the database via a web form...



any idea on how to do this??



ray

ray@j...

Message #2 by "Dallas Martin" <dmartin@z...> on Wed, 11 Oct 2000 18:49:56 -0400
Ray,



You have to re-install SQL 7 with Unicode support enabled

The Unicode local ID is a special read-only option that can

only be changed by re-installing SQL7. The character set

chosen at installation time cannot be changed without transfer of

data and rebuild of the installation. This is because the usual

storage for each character is one byte, with Unicode, two bytes

are used to store characters.Unicode is supported in the nchar,

nvarchar and ntext datatypes. SQL 7 supports 14 character sets,

but only one can be selected at time. Whatever character set

is chosen must be the same on the server and clients (ASP).

By default SQL7 choses the ISO Character Set. (ISO-8859-1,

Latin-1 or ANSI character set).



Dallas Martin







----- Original Message -----

From: <ray@j...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, October 11, 2000 3:46 PM

Subject: [asp_databases] inserting unicode data into SQL 7 via web forms





> My setup:

> Server:

> Windows 2k server

> IIS 5

> Accessing SQL Server 7 on an NT4 machine via a connect string in ASP

>

> all installs are english standard versions.

>

> I am trying with NO success to insert data into my SQL server 7 database

> as UNICODE.  I have a web page with defined as charset=UTF-8 and has

> several text form elements.  In my asp code I set the codepage = 65001 and

> that is supposed to convert all the UTF-8 data to UCS-2 right???  well

> it's not working on the way in... but it seems to be working on the way

> out.  If i paste some chinese text into the form and insert it all i get

> are a bunch of ?'s in the db.  I thought at first.. well it's ?'s cause i

> dont have chinese SQL 7 so lets see if it comes out fine... so i have an

> ASP app that set the codepage to 65001 and gets the data from SQL 7...  it

> displays as a bunch of ?'s !!!  So basically i know it's not working.

> Now... if i insert RAW UTF-8 data the same app will CONVERT is again on

> the way out... so it seems like it is converting on the way out.. BUT i

> cant get valid UCS-2 data into the database via a web form...

>

> any idea on how to do this??

>

> ray

> ray@j...

>

> ---

> NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?

> Visit EarthWeb for the latest in IT Management, Software Development,

> Web Development, Networking & Communications, and Hardware & Systems.

> Click on http://www.earthweb.com for FREE articles, tutorials,

> and discussions from the experts.

> ---



Message #3 by "Jez" <ray@j...> on Thu, 12 Oct 2000 08:49:22 -0500
Dallas,



Thats makes sense to me however according to MS I should not have to

re-install SQL 7.  In the document @

http://msdn.microsoft.com/library/psdk/sql/8_ar_da_10.htm it says:

--------------------------------------------------------------------------

It is easier to manage international databases if you:



>>Install SQL Server with the default code page. <<

Implement all char, varchar, and text columns using their Unicode

equivalents; nchar, nvarchar, and ntext.

The fact that Unicode data needs twice as much storage space is offset by

eliminating the need to convert extended characters between code pages.



SQL Server 7.0 stores all textual system catalog data in columns having

Unicode data types. The names of database objects such as tables, views, and

stored procedures are stored in Unicode columns. This allows applications to

be developed using only Unicode, which avoids all issues with code page

conversions.

----------------------------------------------------------------------------

--



It seems to me from this doc that the installed codepage has NO bearing on

the n* datatypes and that SQL 7 has unicode support built automatically in

by their inclusion.  Maybe I am misunderstanding the document and maybe MS

is wrong here... but if you have done this successfully then I will

reinstall gladly!



Thanks for the reply.



Ray



-----Original Message-----

From: Dallas Martin [mailto:dmartin@z...]

Sent: Wednesday, October 11, 2000 5:50 PM

To: ASP Databases

Subject: [asp_databases] Re: inserting unicode data into SQL 7 via web

forms





Ray,



You have to re-install SQL 7 with Unicode support enabled

The Unicode local ID is a special read-only option that can

only be changed by re-installing SQL7. The character set

chosen at installation time cannot be changed without transfer of

data and rebuild of the installation. This is because the usual

storage for each character is one byte, with Unicode, two bytes

are used to store characters.Unicode is supported in the nchar,

nvarchar and ntext datatypes. SQL 7 supports 14 character sets,

but only one can be selected at time. Whatever character set

is chosen must be the same on the server and clients (ASP).

By default SQL7 choses the ISO Character Set. (ISO-8859-1,

Latin-1 or ANSI character set).



Dallas Martin







----- Original Message -----

From: <ray@j...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, October 11, 2000 3:46 PM

Subject: [asp_databases] inserting unicode data into SQL 7 via web forms





> My setup:

> Server:

> Windows 2k server

> IIS 5

> Accessing SQL Server 7 on an NT4 machine via a connect string in ASP

>

> all installs are english standard versions.

>

> I am trying with NO success to insert data into my SQL server 7 database

> as UNICODE.  I have a web page with defined as charset=UTF-8 and has

> several text form elements.  In my asp code I set the codepage = 65001 and

> that is supposed to convert all the UTF-8 data to UCS-2 right???  well

> it's not working on the way in... but it seems to be working on the way

> out.  If i paste some chinese text into the form and insert it all i get

> are a bunch of ?'s in the db.  I thought at first.. well it's ?'s cause i

> dont have chinese SQL 7 so lets see if it comes out fine... so i have an



> ASP app that set the codepage to 65001 and gets the data from SQL 7...  it

> displays as a bunch of ?'s !!!  So basically i know it's not working.

> Now... if i insert RAW UTF-8 data the same app will CONVERT is again on

> the way out... so it seems like it is converting on the way out.. BUT i

> cant get valid UCS-2 data into the database via a web form...

>

> any idea on how to do this??

>

> ray

> ray@j...

>


  Return to Index