Forum Moderators: open

Message Too Old, No Replies

Reading foreign characters (Thai) from database

Moved from ASP to .ASP ASP has no problem with sane record

         

Thalwin

5:03 am on Mar 29, 2004 (gmt 0)

10+ Year Member



In the database I have mixed content of English and Thai. For example the next text is stored in the database:

โปรแกรมบัญชีสำเร็จรูป/Software (field type nvarchar)

When reading the record in normal ASP I get the same characters as in the database and by setting the encoding for the page to Thai no problem, it works!

In ASP.Net I get <all questionmarks>/Software'

Had simular problem with static text but solved this by changing the web.config file the <globalization/> setting:

<globalization
fileEncoding="windows-874"
requestEncoding="windows-874"
responseEncoding="windows-874"/>

So now I have a Thai Web page with normal content in Thai except for what I read form the database!

Anyone that can help with this?

Xoc

8:26 pm on Mar 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm guessing here, but after you read from the database, try doing a Response.HTMLEncode on the string returned from the database. This should convert the characters into the proper HTML in the output.

Thalwin

9:31 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



Can not locate the Response.HTMLEncode method, know they have server.HTMLEncode but this does not help. Try to play with <%@codepage=code%> and this seems to have an effect on the page output of the database. But don't have a list of codes for different encodings/languages

I made some progress by using in web.options the following:
<globalization
fileEncoding="windows-874"
requestEncoding="UTF-8"
responseEncoding="UTF-8"/>

This will solves the question marks problem and now I get the same characters as in the database but still no Thai!