Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => PostgreSQL and SQLite Support => Topic started by: cybernd on June 23, 2008, 07:34:29 PM

Title: 2.0 b3.1 + postgresql encoding issue
Post by: cybernd on June 23, 2008, 07:34:29 PM
Running 2.0 beta 3.1 with postgresql 8.3.

Whenever i try to post something containing chars like umlauts it leads to an database error.

The following database is the result of trying to post an 'ΓΌ' inside the message body.

Quote
ERROR: invalid byte sequence for encoding "UTF8": 0xfc
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
File: /home/www/org.jorona.forum/Sources/Subs-Post.php
Line: 1804

Im sure that client_encoding contains "UTF8" when the insert statement is executed.

The pg database itself was created with the UTF8 enconding setting.

Any ideas?

thx
Bernhard
Title: Re: 2.0 b3.1 + postgresql encoding issue
Post by: Oldiesmann on June 23, 2008, 10:21:54 PM
What do you have $db_charset set to in Settings.php, and what's your SMF character set?
Title: Re: 2.0 b3.1 + postgresql encoding issue
Post by: cybernd on June 24, 2008, 02:15:29 PM
Per default the $db_charset does not even exist inside Settings.php.

But i already heared about this variable because someone told me about it in the IRC channel.
So i tried to add it with different settings, but none of them changed anything.

i tried the following values: 'utf8', 'UTF8', 'utf-8', 'UTF-8', 'ISO-8859-1'
Im not even sure if the db_charset is used inside 2.0 beta 3.1, because all occourences seem to be only used inside the maintenence section.


thx,
Bernhard
Title: Re: 2.0 b3.1 + postgresql encoding issue
Post by: Oldiesmann on June 24, 2008, 05:23:50 PM
It's actually $db_character_set, not $db_charset as I initially stated.

Try adding this to Settings.php:

$db_character_set = "'UTF8'";

The double quotes are needed because SMF doesn't pass the value as a string (see the reloadSettings function in Sources/Load.php).