php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55621 utf8_decode has a problem when the crypted char ß is next to an umlaut
Submitted: 2011-09-06 12:53 UTC Modified: 2011-09-06 14:19 UTC
From: mike at mike-systems dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.8 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mike at mike-systems dot de
New email:
PHP Version: OS:

 

 [2011-09-06 12:53 UTC] mike at mike-systems dot de
Description:
------------
I've user the function utf8_decode to decode the following text:

Zur Haupt- und Notentwässerung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei größeren genutzten und ungenutzten Dachflächen


utf8_decode decodes the string with just one problem. The decode function returns this text:

Zur Haupt- und Notentwässerung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei grö�?eren genutzten und ungenutzten Dachflächen

the word "größeren" couldn't be decoded. I've searched on google but don't find an issue or a way to solve the problem.. then i just tried to replace the char "ß" with and its own code.. i've solved the problem.. 

$test = str_replace("ß",utf8_encode("ß"),$test);

after this the problem is solved and the string is correctly trnaslated:

Zur Haupt- und Notentwässerung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei größeren genutzten und ungenutzten Dachflächen


I testet to place other chars like ö and ä next to each other but this isnt a problem for the function. But each special char (ö, ä ,ü) that i put next to an ß couldn't be decoded.. is this an error or what is the problem??

Test script:
---------------
$test = "Zur Haupt- und Notentwäüsserung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei größeren genutzten und ungenutzten Dachflächen";

echo utf8_decode($test) . "<hr/>";

// the output is:
// Zur Haupt- und Notentwäüsserung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei grö�?eren genutzten und ungenutzten Dachflächen

###################################

$test = str_replace("ß",utf8_encode("ß"),$test);

echo utf8_decode($test);

// the output is: 
// Zur Haupt- und Notentwäüsserung nach DIN EN 12056-3 und DIN 1986-100 und zum vorbeugenden Brandschutz bei größeren genutzten und ungenutzten Dachflächen


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-06 14:19 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-09-06 14:19 UTC] cataphract@php.net
Can't reproduce:

php -r "echo bin2hex(utf8_decode('größeren'));"
6772f6df6572656e

ö is encoded as 0xF6 and ß as 0xDF, as expected.

Closing as bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 06:01:38 2025 UTC