php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66278 Transliteration with iconv() on Windows
Submitted: 2013-12-12 18:24 UTC Modified: 2014-03-27 11:26 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: kacper at kacper dot se Assigned:
Status: Not a bug Package: ICONV related
PHP Version: 5.4.22 OS: Windows
Private report: No CVE-ID: None
 [2013-12-12 18:24 UTC] kacper at kacper dot se
Description:
------------
When iconv is used for transliteration on Linux, characters such as ä become ae. On Windows, iconv returns "a instead of ae (note the double quote before the letter).

Test script:
---------------
$utf8_umlaut_a = 'ä';

// On Linux ä = ae
setlocale(LC_CTYPE, 'de_DE');
echo iconv('UTF-8', 'ASCII//TRANSLIT', $utf8_umlaut_a);

// On Windows ä = "a
setlocale(LC_CTYPE, 'german');
echo iconv('UTF-8', 'ASCII//TRANSLIT', $utf8_umlaut_a);

Expected result:
----------------
On Windows iconv should return the same result as on Linux. ä should be returned as ae and not "a.

Actual result:
--------------
ä becomes "a.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-27 11:26 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2014-03-27 11:26 UTC] ab@php.net
This is how iconv handles it, please see http://git.savannah.gnu.org/cgit/libiconv.git/tree/lib/translit.def#n93 . The "ä" is represented as one char U-00E4, so what is done is completely how iconv thinks it should be.

I guess you'll see yet another handling on Mac, though have no machine to test. Anyway these are the issues with unicode normalization, not with PHP.

Thanks.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 04:03:35 2021 UTC