Bug #72803 [NEW]: Failure to transliterate on Linux
From: rasmus at mindplay dot dk
Operating system: Linux
PHP version: Irrelevant
Package: ICONV related
Bug Type: Bug
Bug description:Failure to transliterate on Linux
Description:
------------
I've come across one character that doesn't transliterate correctly with
iconv() with the "TRANSLIT" option on Linux.
On Windows, it works - on every Linux build (PHP 5.3, 5.4, 5.5, 5.6, 7.0
and HHVM) it fails for this one character.
Unfortunately, this particular character is a normal character in Danish
language, and the sites we build are in Danish.
The expected result posted below is that from a Windows build - the
actual result is the erroneous result from a Linux build.
I know that libiconv is largely unmaintained, so maybe there is nothing
to be done about this - a comment in the manual says to use mbstring and
intl instead, but intl isn't a standard extension, and mbstring doesn't
seem to have this feature?
I can work around this particular case, of course, by replacing ø and
à myself first, but I find it problematic that this common operation
isn't otherwise supported (or doesn't work) in PHP.
Test script:
---------------
<?php
// https://gist.github.com/mindplay-dk/9b2fa55ba5f08ab0b9308295f936cd41
$string = 'æøå'; // HEX: c3 a6 c3 b8 c3 a5
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
var_dump($clean); // "aeoa" on Windows, "ae?a" on Linux???
Expected result:
----------------
string(4) "aeoa"
Actual result:
--------------
string(4) "ae?a"
--
Edit bug report at https://bugs.php.net/bug.php?id=72803&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72803&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72803&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72803&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72803&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72803&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72803&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72803&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72803&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72803&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72803&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72803&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72803&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72803&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72803&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72803&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72803&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72803&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72803&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72803&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72803&r=mysqlcfg
Thread (3 messages)
- rasmus at mindplay dot dk