An umlaut problem
An umlaut problem
Script URL: http://mg.hasenlauf.de/t/gbook/gbook.php
Version of script: 1.7
Hosting company: unknown, it's a rented system by a friend of me, I assume it's a dedicated server
URL of phpinfo.php: http://mg.hasenlauf.de/t/gbook/phpinfo.php
URL of session_test.php: http://mg.hasenlauf.de/t/gbook/session_test.php
What terms did you try when SEARCHING for a solution: umlaut, coding, iso-8859-1, utf-8
Dear friends of GBook,
Regading my test installation (URL see above), function "Sign guestbook": Every time, when I use an "umlaut" character (e. g. "André", characters like äÄöÖüÜßéÉèÈêÊóÓòÒâ ...) in the entry field "Your name:" or "Comments:" and I press "SUBMIT MY COMMENT", the field gets cleared and an error message occures ("Please enter your name"/"Please enter your comments").
It's curious, the Demo GBook Guestbook doesn't have this problem. So my question is, what's the difference between my test installation and the demo guestbook?
I asssumed, the problem lies in the page coding. Therefore I tried different settings in language.inc.php. Instead of the default $lang['enc']='windows-1250'; I tried $lang['enc']='iso-8859-15'; and $lang['enc']='utf-8';, but this didn't solve the problem.
Does anyone has an idea what causes this problem?
Kind regards,
Griffel
Version of script: 1.7
Hosting company: unknown, it's a rented system by a friend of me, I assume it's a dedicated server
URL of phpinfo.php: http://mg.hasenlauf.de/t/gbook/phpinfo.php
URL of session_test.php: http://mg.hasenlauf.de/t/gbook/session_test.php
What terms did you try when SEARCHING for a solution: umlaut, coding, iso-8859-1, utf-8
Dear friends of GBook,
Regading my test installation (URL see above), function "Sign guestbook": Every time, when I use an "umlaut" character (e. g. "André", characters like äÄöÖüÜßéÉèÈêÊóÓòÒâ ...) in the entry field "Your name:" or "Comments:" and I press "SUBMIT MY COMMENT", the field gets cleared and an error message occures ("Please enter your name"/"Please enter your comments").
It's curious, the Demo GBook Guestbook doesn't have this problem. So my question is, what's the difference between my test installation and the demo guestbook?
I asssumed, the problem lies in the page coding. Therefore I tried different settings in language.inc.php. Instead of the default $lang['enc']='windows-1250'; I tried $lang['enc']='iso-8859-15'; and $lang['enc']='utf-8';, but this didn't solve the problem.
Does anyone has an idea what causes this problem?
Kind regards,
Griffel
Last edited by Griffel on Wed Nov 20, 2013 12:37 am, edited 2 times in total.
Re: An umlaut problem
Hi,
This happens because of a very annoying change PHP team did in PHP a while ago and has been causing endless headaches to international developers since.
Anyway, please try this:
1. Use
2. In gbook.php change this code to this
This happens because of a very annoying change PHP team did in PHP a while ago and has been causing endless headaches to international developers since.
Anyway, please try this:
1. Use
Code: Select all
$lang['enc']='utf-8';
Code: Select all
$in = htmlspecialchars($in);
Code: Select all
$in = htmlspecialchars($in, ENT_COMPAT | ENT_SUBSTITUTE | ENT_XHTML, 'UTF-8');
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: An umlaut problem
Thanks, Klemen for the quick reply.
Now input of umlaut chars works, fine!
But, look at the output, the umlaut signs are not right displayed: http://mg.hasenlauf.de/t/gbook/gbook.php
I checked it with different browsers, Chrome, Firefox, IE and Safari. No matter what browser, the problem occures at all browsers.
Kind regards,
Griffel
Now input of umlaut chars works, fine!
But, look at the output, the umlaut signs are not right displayed: http://mg.hasenlauf.de/t/gbook/gbook.php
I checked it with different browsers, Chrome, Firefox, IE and Safari. No matter what browser, the problem occures at all browsers.
Kind regards,
Griffel
Re: An umlaut problem
Hmm, does it make any difference if you use uppercase UTF-8 in language file?
(make the change and before testing close all browser windows)
Code: Select all
$lang['enc']='UTF-8';
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: An umlaut problem
No, it makes no difference. Again, I checked it with the 4 browsers (closing all windows, restart).
Thanks again for your help!
Regards,
Griffel
Thanks again for your help!
Regards,
Griffel
Re: An umlaut problem
BTW, the problem occures at the notification e-mails too.
Suject: Someone has just signed your guestbook
Hello!
Someone has just signed your guestbook!
Name: G�nter
From:
E-mail:
Website:
Message (without smileys):
Umlaut-Test. �������
Visit the below URL to view your guestbook:
http://mg.hasenlauf.de/t/gbook/gbook.php
End of message
Griffel
Suject: Someone has just signed your guestbook
Hello!
Someone has just signed your guestbook!
Name: G�nter
From:
E-mail:
Website:
Message (without smileys):
Umlaut-Test. �������
Visit the below URL to view your guestbook:
http://mg.hasenlauf.de/t/gbook/gbook.php
End of message
Griffel
Re: An umlaut problem
The problem seems to be that the browser isn't detecting encoding as UTF-8, but as Western European.
If I force the page to be displayed in UTF-8 and submit an entry it works fine.
What I would try is:
1. Upload an empty "entries.txt" file
2. Open these files in a powerful text editor, such as the free Notepad++:
gbook.php
language.inc.php
settings.php
3. Save all these three files in UTF-8 encoding *without* BOM (byte order mark)
4. Upload and test again.
If I force the page to be displayed in UTF-8 and submit an entry it works fine.
What I would try is:
1. Upload an empty "entries.txt" file
2. Open these files in a powerful text editor, such as the free Notepad++:
gbook.php
language.inc.php
settings.php
3. Save all these three files in UTF-8 encoding *without* BOM (byte order mark)
4. Upload and test again.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: An umlaut problem
Dear Klemen,
I did so, but it doesn't help.
In notepad++ I converted the files to UTF-8 without BOM.
What do you think about this try:
Include <meta charset="UTF-8"> in the <head>-section of the web pages.
But I don't know where to insert this in which file.
Regards,
Griffel
I did so, but it doesn't help.
In notepad++ I converted the files to UTF-8 without BOM.
What do you think about this try:
Include <meta charset="UTF-8"> in the <head>-section of the web pages.
But I don't know where to insert this in which file.
Regards,
Griffel
Re: An umlaut problem
That won't help, the two tags are compatible.
I think I found the problem - your server is sending this header inside the "t" folder:
This makes the browser select iso-8859-15 and disregard what the HTML tells it.
You will need to verify (with your host) why this header is being forced.
You can also try adding this to the top of your gbook.php (just after <?php ) and see if it helps, not sure if the server-set header will prevail or not:
I think I found the problem - your server is sending this header inside the "t" folder:
Code: Select all
Content-Type: text/html; charset=iso-8859-15
You will need to verify (with your host) why this header is being forced.
You can also try adding this to the top of your gbook.php (just after <?php ) and see if it helps, not sure if the server-set header will prevail or not:
Code: Select all
header('Content-Type: text/html; charset=utf-8');
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: An umlaut problem
Yers, it can be seen by phpinfo.php, section "Core", value of "default_charset".Klemen wrote:I think I found the problem - your server is sending this header inside the "t" folder:Code: Select all
Content-Type: text/html; charset=iso-8859-15
I will do so.Klemen wrote:You will need to verify (with your host) why this header is being forced.
This works!Klemen wrote:You can also try adding this to the top of your gbook.php (just after <?php ) and see if it helps, not sure if the server-set header will prevail or not:Code: Select all
header('Content-Type: text/html; charset=utf-8');
Even the notification email is now right formatted.
Thanks a lot for your support!
Kind Regards,
Griffel
One more small question
One more small question: Now I'm going to fix some errors in "deutsch.inc.php". There are umlauts represented like "ä" for "ä".
Is there a trick in Notepad++ to let the editor format the umlauts in this way?
Is there a trick in Notepad++ to let the editor format the umlauts in this way?
Re: An umlaut problem
Not that I know, you will probably need to rely on the old "Search and replace"...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools