Problem with special characters in comments [SOLVED]

Found a bug? Tell us!!
Post Reply
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Problem with special characters in comments [SOLVED]

Post by WebComPas »

Hallo!

Today someone added a comment to an entry in my blog. This comment contained an "ε" (Epsilon). Within the email which was sent for moderation everything was OK. But within the comment showed on my blog this character was replaced by a "?" (see original). But don't confuse this with the character showed when the character encodings are not correct!
To solve this problem I tried to replace this question mark manually with the correct character, but without success.

Does anyone have an idea why this doesn't work or if this could really be a bug?

Regards,
Pascal
Last edited by WebComPas on Tue Apr 26, 2011 11:39 pm, edited 1 time in total.
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Problem with special characters in comments

Post by Timbalu »

Hi
But don't confuse this with the character showed when the character encodings are not correct!
Pardon?

The symbol needs to be from the same character set as your page and database is set for.
As your page is set to UTF-8, you need to check the database settings to be in UTF-8 format too.

Are you using the most recent MySQL version? This one should have charset support. Changes will only effect new entries.

ε is part of unicode ε ε ε
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Re: Problem with special characters in comments

Post by WebComPas »

I know, that all the encodings have to be set correctly. But this can't be the problem, because other special characters (for example the German umlauts) work without problems.
Checking the hex dump of this page also confirmed that the HTML code really contains a question mark (0x3F UTF-8).
So there must be another reason for this strange behaviour.
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Problem with special characters in comments

Post by Timbalu »

Since the email was send by GET/POST data and the show comment is build by database data, this is the only way I can think of. Did you check the correct table for comments?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Re: Problem with special characters in comments

Post by WebComPas »

Up to now I always tried to edit the comment using the comment edit form within the admin area. Now I tried to execute the corresponding UPDATE query:

Code: Select all

UPDATE blog_comments SET body='ebenfalls danke - ε/2' WHERE id=209;
This resulted in the following error message:
Warning: #1366 Incorrect string value: '\xCE\xB5/2' for column 'body' at row 1
So I checked my database for the specified collations. Most tables had utf8_general_ci but some (including the comments table) had latin1_swedish_ci. After I had changed this the problem concerning the Epsilon didn't occur anymore.
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Problem with special characters in comments

Post by Timbalu »

Well done.
That is the sort of solution my answers were heading to. :wink:
latin_swedish has a build in umlaut support, as far as I remember.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply