[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8175
  • Last Modified:

Insert THAI character language into SQL 2000 DB

Hi,

Anybody knows how to insert thai characters correctly into SQL 2000 DB (displayed Thai characters correctly in SQL Enterprise manager)?
Should JSP page encoding set to TIS-620 or UTF-8?
What about the SQL 2000 DB? THAI_CI_AS?

Please advise, Thanks.
0
rospcc
Asked:
rospcc
  • 8
  • 5
  • 5
  • +1
3 Solutions
 
Ryan ChongCommented:
Your need to use column type of NChar, NVarChar or NText instead, which can handle unicode characters
0
 
rospccAuthor Commented:
Hi ryan,

It has been set to NVarChar, that's why when I insert manually to SQL Enterprise manager, I can see the Thai characters correctly.
The problem exist when I display out the Thai characters from the DB to the page, it just display unreadable characters.

I think the encoding between JSP page and SQL DB is different, that's why creating such problem.
0
 
Ryan ChongCommented:
I think it's because your HTML is not encoded properly.. Your JSP header should set to "charset=tis-620" ?

like in HTML, try add:

...
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
...

>>Should JSP page encoding set to TIS-620 or UTF-8?
Yes, definitely. Is this works now?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rospccAuthor Commented:
Yes, I've used that, but the database keeps on showing unreadable characters like: &#3585;&#3627;&#3604;&#3585;&#3627;

I'm suspecting it's UTF-8 formatting, because I'm able to display out correctly to JSP page.
If there's no way to change such encodings in DB, Do you have a convertor to convert UTF-8 to the Thai characters?
0
 
Ryan ChongCommented:
Try checking your row data from database, make sure it's encoded in Thai format?

What if you make a test page, try add the header provided above, then enter some Thai characters there to do testing, is that the Thai characters show correctly there?

>>Do you have a convertor to convert UTF-8 to the Thai characters?
No, i don't speak Thai :)
0
 
rospccAuthor Commented:
Nope, the characters above were not Thai and those characters are in the DB.

I've made the 2 test pages:
1. Without going through DB
    Managed to input Thai into Textbox and output (out.println) into Thai.
2. Going through DB
    Inputted Thai, but UTF-8 characters (I think) stored into DB, but can display correctly in JSP.
0
 
nurbekCommented:
try this
while inserting and reading from database
put it top of your page

<%@ LANGUAGE=vbscript  LCID=1054  %>
0
 
rospccAuthor Commented:
Hi nurbek,

My application is in JSP.
0
 
nurbekCommented:
try

<%@  LCID=1054  %>
0
 
rospccAuthor Commented:
It shows me "Invalid directive"
0
 
nurbekCommented:
hmm

your machine doesnt support thai :)

from regional settings change it (or install) thai

From General selecal "your locale"

and then "language settings for system" check thai language (it may need to restart)

0
 
rospccAuthor Commented:
My machine supports thai actually.
I can see Thai language in web pages.
0
 
nurbekCommented:
of course
 you can see different languages in your web page (japanese, english, russian)  if the encoding language is installed

but what i mean is that when you click the time (clock) can you see the weekday names (monthes) in thai?

when you install the thai regional setting then you will be able to see  thai charachters correctly

0
 
rospccAuthor Commented:
yes. All the months in my system are in Thai.
Could your give me the sample code which have <%@  LCID=1054  %> in JSP? Thanks.
0
 
nurbekCommented:
try

<%@ LANGUAGE=JScript LCID=1054 %>

if not installed you will get "not available error"

0
 
Ryan ChongCommented:
>>1. Without going through DB
>>    Managed to input Thai into Textbox and output (out.println) into Thai.
>>2. Going through DB
>>    Inputted Thai, but UTF-8 characters (I think) stored into DB, but can display correctly in JSP.

That's means your data got problem! and when your page adding the encode header, your JSP page was unable to encode it and display correctly on the screen.

So, the problem is on your Data, NOT from your JSP/ Servlet server.
0
 
Ryan ChongCommented:
>>You can specify a collation of 874 for storing Thai data.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_5ell.asp

More and tutorial available at http:Q_20869984.html
0
 
rdcproCommented:
These character references:

&#3585;&#3627;&#3604;&#3585;&#3627;

are the UTF-16M decimal equivalents of:

&#3585;&#3627;&#3604;&#3585;&#3627;

Any "normal" HTML page should be able to correctly interpret these, and it appears you have the correct font glyphs.  Those character references generally get created when the data passes through something that doesn't actually have code points for the characters.  If your DB columns are ntext, nchar, nvarchar then it appears the conversion to character references is either happening when the data is entered, or by something when the data is extracted.  You're saying these character references are actually in the DB, so I'd say that the conversion is happening when data is inserted.  How do you get the data in the DB in the first place?  

Regards,
Mike Sharp
0
 
rospccAuthor Commented:
I've managed to do it.
I built one Unicode Translator.
Anyway, thanks all.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 8
  • 5
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now