Eatern-european characters

Eatern-european characters

am 24.10.2007 02:58:30 von jan

Hi,

I am using an ACCESS-database to store Slovak words. Those words may
contain special characters like : Č Ď Ě Ľ Ň Ř=
Š Ť Ž.
When I want to retreave and show those words in IE using ASP, those
characters are replaced by a questionmark! I suppose I need to use
codepages, and I have done quit som research on the internet but I can
not get it to work properly...
Who can help me with this ???

Thanks,
Janošik.

Re: Eatern-european characters

am 24.10.2007 10:02:24 von Anthony Jones

"Janosik" wrote in message
news:1193187510.633984.310640@e9g2000prf.googlegroups.com...
>Hi,
>
>I am using an ACCESS-database to store Slovak words. Those words may
>contain special characters like : C D E L N R S T Z.
>When I want to retreave and show those words in IE using ASP, those
>characters are replaced by a questionmark! I suppose I need to use
>codepages, and I have done quit som research on the internet but I can
>not get it to work properly...
>Who can help me with this ???


Make sure you save your ASP pages are saved using UTF-8 encoding.

Add in the top your pages:-

<%@codepage=65001 %>

Also add in the code of your page:-

Response.CharSet = "UTF-8"

Are using HTML forms where the user may enter such characters that are then
posted to an ASP page to be saved in the DB? If so and your receiving pages
were not set to the correct codepage you may have some corrupt data in your
DB.


--
Anthony Jones - MVP ASP/ASP.NET

Re: Eatern-european characters

am 06.11.2007 14:13:13 von jan

Hi again,

I found some PHP-code that works fine, but I can't get it to work in
ASP :

$mysql_id=3Dmysql_connect("$dbhost","$dbuser","$dbpass");
mysql_query("SET CHARACTER SET 'utf8'", $mysql_id);

What's the ASP-version for this last line?
It should explicitly define encoding in which data are transferred
from the database.

Thanks and best regards,
Janošik.

Re: Eatern-european characters

am 06.11.2007 14:59:51 von Anthony Jones

"Janosik" wrote in message
news:1194354793.475142.61470@19g2000hsx.googlegroups.com...
>Hi again,
>
>I found some PHP-code that works fine, but I can't get it to work in
>ASP :
>
> $mysql_id=mysql_connect("$dbhost","$dbuser","$dbpass");
> mysql_query("SET CHARACTER SET 'utf8'", $mysql_id);
>
>What's the ASP-version for this last line?

There isn't one. ASP doesn't provide the same seamless DB access functions
that PHP does for MySQL. I would guess you would need an ADODB connection
using an ODBC provider and the MySQL ODBC connector. You may then be able
to execute this command using the connection execute method.
However whether that is useful or not I can't say.

>It should explicitly define encoding in which data are transferred
>from the database.

Yes it should see the client (thats the Web server in thisc case) as a
Unicode user. All strings in ADO and VBScript/JScript are unicode. IIRC
correctly there is a configuration setting somewhere in MySQL which
specifies what assumption it can make about the codepage the client is
using. I could be wrong MySQL isn't common in ASP development.

Once the string is retreived correctly from the DB Server as unicode string
it can be written to the browser using the techiniques I've already posted.

BTW, why not just stick with PHP?

--
Anthony Jones - MVP ASP/ASP.NET

Re: Eatern-european characters

am 06.11.2007 16:49:29 von jan

On 6 nov, 14:59, "Anthony Jones" wrote:
>..  You may then be able to execute this command using the connect=
ion execute method.

I used this command :

objConn.Execute "SET CHARACTER SET UTF8"

and it finally works :-) !

However... it seems to me there still is something strange going on...
I used the command ONCE ine ONE ASP-test... and it worked!
Suddenly, all the other ASP-tests also work, even without inserting
the command.
The PHP-tests however only work WITH the command...

> BTW,  why not just stick with PHP?
>
> --
> Anthony Jones - MVP ASP/ASP.NET

well... I think I don't know enough about PHP to succesfuly complete
this project :-/
I know... it should exactly be a reason to stick with PHP, but .....

anyway, thanks a lot for the super-tips you gave me!

Best regards,
Janošik.