PHP Forums Archive

UTF charset

Tags: htaccess, utf-8, apache

cioop posted on 2008-03-07 07:58:14 #

Hi, I have a problem with encoding: how to change the data charset to UTF as my db is UTF8 and the submitted data look like "Ä™" or "Å" (I've tried to save the files in utf charset and changed <head> <meta charset/> but it doesn't seem to work properly?)

Comments / discussions

Olaf posted on 2008-03-07 08:45:14 #

maybe you need to disable this apache feature:

AddDefaultCharset Off

Just place this code in you .htaccess file (root)

Olaf posted on 2008-03-07 08:45:54 #

... and please post the URL

cioop posted on 2008-03-07 09:44:48 #

http://artpromo.com.pl/classes/access_user/

Olaf posted on 2008-03-07 10:45:46 #

looks good to me (the register page), the static text and also the text from the messages.

How about the text that stored om your database ? for example the company name?

... just noticed that not all pages are having good encoding:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example new Passwort activation</title>
</head>

<body>
<h2>Att. !</h2>
<p style="color:#FF0000;"><b>Twoje konto użytkownika zostało zmodyfikowane.</b></p>
<p>&nbsp;</p>
<!-- Notice! you have to change this links here, if the files are not in the same folder -->
<p><a href="/classes/access_user/login.php">Login</a></p>

</body>
</html>

check this too.

Olaf posted on 2008-03-07 10:46:34 #

btw. while my account exists, I can't login :(

cioop posted on 2008-03-08 10:14:40 #

Hi,
I disabled logging in since registering is not yet finished.
I did set htaccess
But still data in 'users' table looks like:
(24, 'blabla', '4a7d1ed414474e4033ac29ccb8653d9b', 'bez błędów z', 'bez błędów z', 'olaf@lederer.nl', '56456', 'bez błędów z', '46456', 'bez błędów z', '33', '33', 'bez błędów z', '4545', '', '0000-00-00 00:00:00', '', 1, 'y');
I think I'll just store text in such encoding as it is now and then do some coding yoga to make it display right, thanx anyways

Olaf posted on 2008-03-08 10:45:37 #

don't check via phpmyadmin ;)

look if you have you page in utf-8 encoded and your forms are send via some utf-8 encoded page you're fine. If you edit text files using utf-8 you need a good text editor, I use PSPad.

cioop posted on 2008-03-08 10:48:00 #

My editor is fine - I use Kommodo Edit, however I'm exactly checking via phpmyadmin ;)

Olaf posted on 2008-03-08 10:51:30 #

Quote from: cioop
"My editor is fine - I use Kommodo Edit, however I'm exactly checking via phpmyadmin ;)"

hehe, now you know everything I know about using utf-8 for polish language websites :D