logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2.2.5 charset issue, maybe php or sql?
Author
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Tue 22 Jan '08 20:18    Post subject: Apache 2.2.5 charset issue, maybe php or sql? Reply with quote

Hi,

I didn't know where to turn so i though id check with you guys, you have alot of knowledge.

I have a issue with files containing swedish letters "åäö" for some reason when i add them to my gallery they will not appear. Im not very good at this but i've figured out that its something with the charsets? When i check my mysql/php info that steffen created i see that all charset are set to UTF-8 which should work for this, but still it don't!

Information :


default_charset utf-8 utf-8
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7

headers information:

Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Content-Type text/html; charset=utf-8

Here you can see the issue in my gallery, pictures are not visible cause they contain one or more of these characters " å ä ö"

http://83.226.208.233/thumbnails.php?album=2556&page=4

pictures that does not contain this will be displayed properly.

i understand that you cannot support my gallery however i dont think this is a gallery issue, i think its either with apache php or sql?

Lets take this picture for example:

http://83.226.208.233/albums/userpics/10127/2556/V%c3%a5rat_Fina_Grill_material.jpg
(might have to refresh the pic to see it, hotlinking disable)
this will display the picture, however through the gallery the code generated is : http://dkeserver.mine.nu/albums/userpics/10127/2556/V%E5rat_Fina_Grill_material.jpg
(might have to refresh the pic to see it, hotlinking disable)

hope you can take a look at it, thank you.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 24 Jan '08 12:26    Post subject: Reply with quote

Caused my hotlinking disabled I cant view that pictures.

On your page http://83.226.208.233/thumbnails.php?album=2556&page=4 there wasn't any å ä ö.

For that european you should use iso-8859-1. In MySQL Database you should use latin1_swedish_ci. UTF-8 is always tricky, because the documents need to be saved in UTF-8 Format. In the worsest case use php's utf8_encode() to convert the links.

I had always trouble with UTF-8 with programming. You need to save all PHP files in UTF-8 which causes often an unwanted header by apache.

----
Edit

%E5 seem to be correct for å if it is iso-8859-1


----
edit 2


mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Mon 28 Jan '08 23:46    Post subject: Reply with quote

Hi james,

I removed the error pictures from the site (or removed the åäö from the filenames) so it didn't look so messed up, however the problem remains.

I really appreciate all the help you give me! Your advice to skip utf-8 is probably smart, however i cannot get it to work with the iso-8859-1 either, i'm not sure what is wrong.

Ive tested the directive
Code:
AddDefaultCharset iso-8859-1
in htaccess but that did not help.

I wonder if its a issue with apache or mysql?

This is how my charsets look in SQL :
Code:
mysql> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+--------------------------+
| Variable_name            | Value                    |
+--------------------------+--------------------------+
| character_set_client     | latin1                   |
| character_set_connection | latin1                   |
| character_set_database   | latin1                   |
| character_set_filesystem | binary                   |
| character_set_results    | latin1                   |
| character_set_server     | latin1                   |
| character_set_system     | utf8                     |
| character_sets_dir       | C:\mysql\share\charsets\ |
+--------------------------+--------------------------+
8 rows in set (0.00 sec)


Latin1 as i understand it from google is the same as iso-8859-1?

I tried to do default-character-set=latin1_swedish_ci but my sql does not have this charset?

Here are some stats regarding charset from phpinfo:

PHP CORE:
default_charset iso-8859-1 iso-8859-1
Apache Environment:
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP Headers Information:
ISO-8859-1,utf-8;q=0.7,*;q=0.7
Content-Type text/html; charset=iso-8859-1
PHP Variables:
_SERVER["HTTP_ACCEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7

Ive changed the webpage to use iso-8859-1 and "åäö" is displayed in the url (when i drag my mouse over the hyperlink), however when i try to access something that has åäö in it, it converts to %E5%E4%F6 and the image wont be displayed.

But when i upload the picture to a location outside the gallery with åäö in the filename the åäö converts to: %c3%a5%c3%a4%c3%b6
and IS viewable.

From this it seems its not an apache issue or maybe apache is running the wrong charset? (i though it defaulted to 8859-1).

I am using mod_security for apache, can this interfeer with the charset this way? Or is there maybe some mod i've accidently turned off that is needed?

Could you figure out where the problem might lie?

Again, thank you so much for your support!

EDIT: If i missed any valuable information please reply with that you need!!

EDIT: updated to apache 2.2.8 and latest version of php, issue still remains.
Back to top


Reply to topic   Topic: Apache 2.2.5 charset issue, maybe php or sql? View previous topic :: View next topic
Post new topic   Forum Index -> Apache