Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 store japanese characters in SQL 2000

Author  Topic 

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2005-12-07 : 19:39:44
hello team,

I want to store japanese characters in a column in a SQL 2000 database and also want to display it in ASP/ASP.NET. I created the column as nvarchar. Please let me know what else i need to do.

Do I need to change the character set in HTML?

Do I need to prefix the values with a N?

Thanks,
Sri





khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-12-07 : 20:26:03
also make sure you choose the correct collation for that column

-----------------
[KH]
Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2005-12-07 : 21:13:58
What is the impact of collation?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-12-07 : 21:25:39
see SQL Server Books OnLine on Collations for details
also see
[url]http://www.sqlservercentral.com/columnists/glarsen/collate_part1.asp[/url]


-----------------
[KH]
Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2005-12-22 : 21:36:11
Team,

ASP is not recognizing japanese characters stored in the db. I have tried utf-16, utf-8 and shift-jis character sets in the meta http tag and it would still not work. Any suggestions on how to make it work? I have fought with it for hours. The front-end shows question marks (?) in place of japanese characters but in the db, the data is in japanese in nvarchar fields. Please advise.

Thanks,
sri

Go to Top of Page

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-23 : 00:35:52
go thru this link if this can help you out..
http://www.microsoft.com/globaldev/getWR/steps/wrg_codepage.mspx

try setting the globalization settings as:
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2005-12-23 : 14:55:47
Shallu1,

The link you sent me helped a lot. I got it to work now. I had to change the codepage and the html charset, both to utf-8 and that did the trick. Initially, I had just changed the html charset and not the codepage.

Thanks much.
Sri
Go to Top of Page

nube
Starting Member

1 Post

Posted - 2006-01-04 : 22:50:55
khtan,

I am having the same problem. Japanese characters in SQL Server column and items displayed in ASP.NET page show “???” Can you describe what you did to fix it?

I have saved the aspx and code behind with encoding with signature. ??? in query analyzer and enterprise manager makes me think that this is not an ASP.NET problem.

Thanks

Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2006-01-05 : 22:53:56
Please read the article link given by shallu1. that should help you.

bye
sri
Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2006-01-14 : 21:42:08
Team,

To support japanese characters in asp and store it as japanese in sql db, I did the following to make it work:

1. Create db fields as nvarchar

2. At the top of the asp page, specify the following

<%@ CODEPAGE = 65001 %>

<% Option Explicit %>

3.
Then specify your meta http tag as follows:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

That's it. You should be able to see japanese being displayed and saved in db. Also, please ensure you have installed japanese fonts on your machine. This may be one of the reasons you see ??? on your screen even though you have done the above 3 steps.

I think the same thing should hold good for ASP.NET. I don't know the syntax to specify codepage in ASP.NET but the sequence of steps should be the same. I think you specify it in the Page tag at the top of the ASP.NET page.

Thanks,
Sri
Go to Top of Page

ssrikrish
Yak Posting Veteran

69 Posts

Posted - 2006-01-17 : 22:30:34
One more to add to my list. The parameter to the proc should be prefixed by the N character.

-Sri
Go to Top of Page
   

- Advertisement -