ASP - need help: Storing foreign char to SQL DB.
-
Hi, I have a problem on storing foreign char to SQL DB. If user inputs a foreign char from asp page, for example, "ROSÉ", it will be stored in the DB as "ROSé". I need to be able to store as it is in the DB, "ROSÉ". BTW, it is displayed properly in the Web GUI. Thanks for any help that you can provide, Charles "Computers are like Old Testament gods; lots of rules and no mercy." -JosephCampbell
-
Hi, I have a problem on storing foreign char to SQL DB. If user inputs a foreign char from asp page, for example, "ROSÉ", it will be stored in the DB as "ROSé". I need to be able to store as it is in the DB, "ROSÉ". BTW, it is displayed properly in the Web GUI. Thanks for any help that you can provide, Charles "Computers are like Old Testament gods; lots of rules and no mercy." -JosephCampbell
You are having a problem with character encoding. The easiest way to fix this problem is to simply replace the É with É the html encoded equivalent before inserting into the database. For a complete list of such encodings visit this page: http://www.bbsinc.com/iso8859.html[^]
Steve McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!" -
Hi, I have a problem on storing foreign char to SQL DB. If user inputs a foreign char from asp page, for example, "ROSÉ", it will be stored in the DB as "ROSé". I need to be able to store as it is in the DB, "ROSÉ". BTW, it is displayed properly in the Web GUI. Thanks for any help that you can provide, Charles "Computers are like Old Testament gods; lots of rules and no mercy." -JosephCampbell
The
Server
object should provide you with some methods to encode and decode characters. Also, make sure the database uses MBCS or Unicode for strings. In SQL Server, this isnvarchar
ornchar
(which pads extra space with spaces).-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Hi, I have a problem on storing foreign char to SQL DB. If user inputs a foreign char from asp page, for example, "ROSÉ", it will be stored in the DB as "ROSé". I need to be able to store as it is in the DB, "ROSÉ". BTW, it is displayed properly in the Web GUI. Thanks for any help that you can provide, Charles "Computers are like Old Testament gods; lots of rules and no mercy." -JosephCampbell
Thanks Steve and Heath for your reply. I found the solution, although it was not obvious at first. It turns out that web application uses UTF-8 encoding, and SQL uses UCS-2. This different encoding standard caused the wrong data conversion. The following article explains the issue: http://support.microsoft.com/default.aspx?scid=kb;EN-US;232580 I hope this helps other people who has similar issue. Charles "Computers are like Old Testament gods; lots of rules and no mercy." -JosephCampbell