Page 1 of 1

Guestbook

Posted: Thu Feb 26, 2015 5:57 pm
by Ove
Script URL:
Version of script:
Hosting company: One.com
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
After an update of the php version to PHP 5.6 at my website my guestbook is not working properly any longer. It is not possible to post messages containing the Swedish charactes å,ä,ö. Messages with only english letters are let through, though. What shall I do so that messages to the guestbook containing Swedish characters are let through too? Thanks and best regards. Ove

Re: Guestbook

Posted: Fri Feb 27, 2015 8:25 am
by Klemen
This is because as of version 5.6 PHP outputs a HTTP header containing the default_charset set in the php.ini file (PHP has actually become a nightmare for anyone not using UTF-8 since version 5.4 onwards...).

In other words - GBook tells your browser to use one encoding, but PHP sends a header saying it is in a different encoding and the browser listen to the HTTP header instead of the GBook HTML source.

Try this:
1. open settings.php file
2. add this to the bottom:

Code: Select all

header('Content-Type: text/html; charset=windows-1250');
3. close all browser windows
4. open guestbook

Does this fix the OLD messages (messages posted BEFORE you updated PHP) and any new messages you post?

A problem will remain - your last few messages have been posted in UTF-8 encoding, so you actually have two different encodings in a single file...