php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63261 htmlentities and htmlspecialchars have problemens with german umlauts
Submitted: 2012-10-11 12:51 UTC Modified: 2012-10-12 05:15 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: hartz at mobilecity dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.4.7 OS: Linux SLES 10
Private report: No CVE-ID: None
 [2012-10-11 12:51 UTC] hartz at mobilecity dot de
Description:
------------
Hi,
with the following line of code you can see the problem.
In PHP 5.4.7 the funtions htmlentities and htmlspecialchars didn't support no more german umlauts. They returns an empty string.

Best regards,
Stephan

Test script:
---------------
echo "TEST:".
htmlentities('ÄÖÜäöüß')."|".htmlspecialchars('ÄÖÜäöüß')."|".'ÄÖÜäöüß';

Expected result:
----------------
TEST: ÄÖÜäöüß|ÄÖÜäöüß|ÄÖÜäöüß

Actual result:
--------------
TEST: ||ÄÖÜäöüß

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-11 12:53 UTC] hartz at mobilecity dot de
In PHP 5.3.x the expected result will be returned. After an update on 5.4.7 it works no more
 [2012-10-11 13:10 UTC] hartz at mobilecity dot de
My shell encoding and my editor encodings are setted to latin1.
This is also no utf8-encoding-problem.
The error occurs after updating my server from 5.3.17 on 5.4.7. 
The php source codes still the same like before the update.
 [2012-10-12 05:13 UTC] rasmus@php.net
You need to specify the encoding. If you are using latin1, do:

htmlentities('ÄÖÜäöüß',NULL,'ISO-8859-1');

PHP 5.4 defaults to UTF-8 because most of the world has switched at this point.
 [2012-10-12 05:15 UTC] rasmus@php.net
.
 [2012-10-12 05:15 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC