Hi experts,
Here I got some problems with my application. (ASP & English Version SQL Server 2000)
As we are using English MSSQL Server 2000, we got some new functions and we have to facilitate support of Chinese characters in the DB. I have set the collation for those Chinese fields already and those queries or Stored Procs for Chinese are working fine, ONLY if I execute them in Enterprise Manager. Chinese characters can be displayed in the relevant tables.
However here comes the big problem and I got really frustrated. As we will provide user interface in ASP pages, we 'll let users to insert the information which will be sent to the DB. If there's Chinese characters in the query string, the Chinese characters added in the DB would be garbled.
e.g. EXECUTE proc_TestChinese 'XYZ', 'test123' (assume XYZ be those Chinese words)
I am wondering if there's any way I can solve this problem. Should I add special handling for these Chinese words? I have set the ASP pages in UTF-8 or Big5 encoding but it doesn't help. Hope you experts can show me the way out of the mess. Thanks in advance!
Manfred
Is your input variabl for the stored procedure a NVARCHAR or any other unicode data type, if not the data will be converted, leading to the problems you described. if you are fine on the database side you should consider posting some code in here which is used for getting the data in the database using ASP Code.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||Hi Jens,
For that particular field for storing Chinese characters, I have set it as nvarchar already with collation settting as Chinese_Taiwan_Stroke_BIN. Here below is the Stored Procedure for testing.
Thanks in advance!
Manfred
to insert the Chinese characters for Germany: 德國 (德國)
use N'xxxx' for nvarchar
EXECUTE proc_TestChinese N'德國', 'Germany'
CREATE Procedure dbo.proc_TestChinese
@.chineseCharacters nvarchar(20),
@.Description varchar(50)
AS
BEGIN
INSERT INTO dbo.tblTestChinese
VALUES(@.chineseCharacters, @.Description)
END
GO
After the SP is executed, the table would shown as ?w°ê for those Chinese characters.
If I have a html file, see http://www.neocollage.com/de.htm . If you change the encoding to Western European then you 'll see the garbled text as in the DB.
No comments:
Post a Comment