Bug #72803 [Com]: Failure to transliterate on Linux

From: Date: Mon, 15 Aug 2016 08:01:10 +0000
Subject: Bug #72803 [Com]: Failure to transliterate on Linux
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203288@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72803&edit=1 ID: 72803 Comment by: rasmus at mindplay dot dk Reported by: rasmus at mindplay dot dk Summary: Failure to transliterate on Linux Status: Open Type: Bug Package: ICONV related Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: To others looking for a solution, the only viable approach appears to be the "intl" extension - it's not enabled by default, but it does ship with the PHP binaries. See here: http://php.net/transliterator_transliterate Previous Comments: ------------------------------------------------------------------------ [2016-08-10 17:07:01] cmb@php.net Looks even worse for glibc-2.2.3/2: <https://3v4l.org/JNOga>. Which version did you use? Anyhow, I think that's not a PHP issue, but rather should be solved upstream. ------------------------------------------------------------------------ [2016-08-10 13:10:00] rasmus at mindplay dot dk 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 this bug report at https://bugs.php.net/bug.php?id=72803&edit=1

« previous php.bugs (#203288) next »