473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Saving Unicode in SQL using ASP

I have an asp application that should allow the user to enter Unicode
characters.

The characters appear correctly in the browser.
When saved in sql 2000 thought they are converted to question marks
etc.
When I enter the characters directly in SQL (using enterprise manager),
they appear correctly in sql as well as in the browser when the asp
page retrieves them.
As soon as I hit save they get overwritten in sql incorrectly.

Any help would be appreciated.
Thanks

Aug 18 '05 #1
6 6317
What does your UPDATE / INSERT statement look like? Are you prefixing your
strings with N prefix to denote Unicode or, better yet, using a Command
object with the correct parameter type?

<hi***@cambridgesoft.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
I have an asp application that should allow the user to enter Unicode
characters.

The characters appear correctly in the browser.
When saved in sql 2000 thought they are converted to question marks
etc.
When I enter the characters directly in SQL (using enterprise manager),
they appear correctly in sql as well as in the browser when the asp
page retrieves them.
As soon as I hit save they get overwritten in sql incorrectly.

Any help would be appreciated.
Thanks

Aug 18 '05 #2
I didn't know that my UPDATE/INSERT should look any different. Can you
give an example of what they should look like?

Thanks

Aug 18 '05 #3
INSERT table_name(column_name) SELECT N'¥'

You need to determine if the unicode character is getting lost between ASP
pages or between the second ASP page and the call to the
update/insert/stored procedure statement.

A very basic and common debugging technique is to response.write sql instead
of conn.execute sql.

A

"hilio" <hi***@cambridgesoft.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I didn't know that my UPDATE/INSERT should look any different. Can you
give an example of what they should look like?

Thanks

Aug 18 '05 #4
Aaron, thanks for the suggestion. I tried response.write and it
displayed different characters, not the characters that are entered by
the user. Would this indicate that the web server is not interpreting
the characters correctly?

Aug 18 '05 #5
first make sure that you are using a character set in the browser that
supports the characters. Then make sure that you are using a code page in
ASP that supports them as well. Simplest way is to use UTF-8

in ASP script
Session.Codepage=65001

then send to browser:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">

Now you should see the same characters back when you write the SQL statement
back.

Now you need to get the data into the database. If you have SQLServer set to
a collation that supports your characterset then it should work now. If not,
you will need to use NCHAR or NTEXT columns. Either use a parameterized
command object or when building dynamic SQL prefix the data string with "N"
to tell SQLServer that the data is unicode.

--
--Mark Schupp
"hilio" <hi***@cambridgesoft.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Aaron, thanks for the suggestion. I tried response.write and it
displayed different characters, not the characters that are entered by
the user. Would this indicate that the web server is not interpreting
the characters correctly?

Aug 18 '05 #6
Thank you both for the replies.
I implemented your suggestions and it now works. I learned that SQL
requires the N prefix for updates and inserts of UNICODE data.

Thank you all

Aug 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Svennglenn | last post by:
I'm working on a program that is supposed to save different information to text files. Because the program is in swedish i have to use unicode text for ÅÄÖ letters. When I run the following...
3
by: LC | last post by:
Hi, I would like to know how I can save my current ASP page to the server side in html file format. Then I would like to stream it back to the client side. Any help is very much...
7
by: Philipp Lenssen | last post by:
How do I load and save a UTF-8 document in XML in ASP/VBS? Well, the loading* is not the problem actually -- the file is in UTF-8, and understood correctly -- but once saved, the UTF-8 is...
1
by: Sudha | last post by:
I have an asp application in asp that should support languages like japanese, french, chinese, malay and english. I am using the characterset as iso-8859-1 in the html meta tag. Most of the...
4
by: Andrew Inwards | last post by:
Is it possible to save a MS Word document in a string? I suspect not because Ive tried saving it in using various encoding formats and it always gets corrupted. Thanks Andrew
3
by: andy_ro | last post by:
Hi group, I have an web application where the user can upload a pdf file. This file is stored in a table, in a column of type ntext. The user can later request the content of this column, and...
2
by: THY | last post by:
Hi, I am developing a website in english & chinese both language. whenever I save, it required I set the encoding in advanced save options. But I found there are 4 related to unicode, can anyone...
2
by: perspolis | last post by:
Hi all I want to save my c# files with unicode encoding. I have some choices in encoding like: 1-Unicode-CodePage1200 2-Unicode(UTF8 with singnaure)-CodePage 65001 3-Unicode(UTF8 without...
1
by: HOWARD MYERS | last post by:
I am developing an Access application which creates text based XML instance files and saves these on the hard drives. How do I programatically save them as Unicode text files and not as the default...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.