SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

2.0 b3.1 + postgresql encoding issue

Started by cybernd, June 23, 2008, 07:34:29 PM

Previous topic - Next topic


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.

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/
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?



What do you have $db_charset set to in Settings.php, and what's your SMF character set?
Michael Eshom
Christian Metal Fans


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.



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).
Michael Eshom
Christian Metal Fans