|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 21:00:01 2025 UTC |
Can't reproduce: php -r "echo bin2hex(utf8_decode('größeren'));" 6772f6df6572656e ö is encoded as 0xF6 and ß as 0xDF, as expected. Closing as bogus.