473,769 Members | 3,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6347
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***@cambridg esoft.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.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(colu mn_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***@cambridg esoft.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.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.Codepag e=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***@cambridg esoft.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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
5681
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 testscript I get an error message. # -*- coding: cp1252 -*-
3
1589
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 appreciated. Thanks,
7
5002
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 replaced by what seems to be iso-8859-1 (which Flash doesn't understand, but that's another problem). Any help greatly appreciated. * Something like this...
1
1655
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 characters are getting stored in the unicode format. But there are few characters in french, japanese and chinese that are not getting stored properly. They are stored as inverted question marks in oracle as well as retrieved in the same format. The...
4
3176
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
16261
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 the application should open a new page and load the pdf content. My problem: If I read the uploaded pdf file into a string variable and then I response.write it right away to another page, it shows fine (I can see a pdf
2
2629
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 tell me what's the different and which to choose ? Unicode (UTF-8 without signature) - Codepage 65001 Unicode (UTF-8 with signature) - Codepage 65001 Unicode - Codepage 1200
2
1823
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 singnaure)-CodePage 65001 which encoding is better to use unicode?/? thanks in advance
1
2018
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 text files ? Thanks in advance for any assistance. H.Myers
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9850
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8862
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7396
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.