1 (edited by Surkow 2007-10-17 17:58)

Topic: Character encoding problems

I had a couple of issues with the character encoding of different language packs. I solved them by saving the language files as UTF-8 and changing <pun_char_encoding> to utf-8. Currently there is a problem I cannot solve and it seems it only occurs on my local server (LAMP) both with modified and clean installs of punbb. Certain mods like the "PBB ChatBox" mod have trouble showing the correct characters. For example, characters with accents are not displayed (instead question marks are shown). After checking the database it seems that all the different input characters are stored correctly in the tables of the database. I know it's not a problem of the script because I worked on different servers where it did seem to work without problems. Is there anything I can try? I already tried converting all tables to utf-8 but it didn't make any difference. Also it does not matter what kind of character encoding is used when viewing the page.

Edit: the following characters are not shown correctly even when the database shows them correctly and the page is in UTF-8:

ä å é ç è

Re: Character encoding problems

Try his in .htaccess works for html files, perhaps you'll have to adjust for php also.

AddDefaultCharset UTF-8
AddCharset UTF-8 .xhtml 
AddType 'text/html; charset=UTF-8' html

3 (edited by Surkow 2007-10-18 11:08)

Re: Character encoding problems

After I created a .htaccess file with that contents and cleared the forum cache directory nothing happened. I was thinking...if it's stored correctly in the database and the forum has no problem with showing those characters is it possible that the database doesn't send the strings in the correct character encoding?

4

Re: Character encoding problems

If you do a search of the forum, I put some info up awhile ago regarding UTF8 requirements. There may be something of use in that post.

5

Re: Character encoding problems

This one: http://punbb.org/forums/viewtopic.php?id=16931

Re: Character encoding problems

Thanks, it seems promising. I'll post my progress.

7 (edited by Surkow 2007-10-18 19:19)

Re: Character encoding problems

$db->query("SET NAMES 'UTF8'")

This seemed to do the trick. The weird thing is that only old messages are now displayed. New typed messages in the chatbox only show up without the special characters (no longer a question mark but still incomplete). I changed the database to utf-8 and the collation as well. What are the other things I need to do? It seems the queries that are send are no longer stored correctly in the database.

8

Re: Character encoding problems

Convert the database information to UTF8. I included the needed info in that thread to convert both pgsql and mysql db's to UTF8. smile

9 (edited by Surkow 2007-10-18 21:34)

Re: Character encoding problems

I already changed the database and table to "utf8_general_ci". I can't seem to think why it doesn't work yet. I used the following command:

sed -e 's/latin1/utf8/g' < sqlfile.sql > newsqlfile.sql

I also checked the table that contains the messages of the chatbox and the new messages are not displayed correctly because they are now stored without special characters. I'm now looking at the script of the chatbox mod but I can't seem to find any problems with it.