php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52836 iconv //TRANSLIT property not functioning as it should
Submitted: 2010-09-14 10:41 UTC Modified: 2010-09-14 11:27 UTC
From: danny at studyportals dot eu Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.3 OS: Windows 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danny at studyportals dot eu
New email:
PHP Version: OS:

 

 [2010-09-14 10:41 UTC] danny at studyportals dot eu
Description:
------------
This bug was discovered in libiconv 1.11

The //TRANSLIT property seems to be discarded. While passing this property and 
encountering characters as € it handles as if you used the plain variant on it. 
See test case below, this is the example given in the PHP docs 
(http://php.net/manual/en/function.iconv.php)

Test script:
---------------
<?php

$text = "This is the Euro symbol '€'.";

echo 'Original : ', $text, PHP_EOL;
echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
echo 'IGNORE   : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
echo 'Plain    : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;

?>

Expected result:
----------------
Original : This is the Euro symbol '€'.
TRANSLIT : This is the Euro symbol 'EUR'.
IGNORE   : This is the Euro symbol ''.
Plain    :
Notice: iconv(): Detected an illegal character in input string in .\iconv-
example.php on line 7
This is the Euro symbol '

(Example on http://php.net/manual/en/function.iconv.php)

Actual result:
--------------
Original : This is the Euro symbol '€'.
TRANSLIT : Notice: iconv(): Detected an illegal character in input string in 
D:\Web\Webroot\test.php on line 6 
This is the Euro symbol '
IGNORE : This is the Euro symbol ''.
Plain : Notice: iconv(): Detected an illegal character in input string in 
D:\Web\Webroot\test.php on line 8
This is the Euro symbol ' 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-14 10:48 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2010-09-14 10:48 UTC] aharvey@php.net
Are you sure your PHP script is saved as UTF-8? This works as expected for me when it is, but fails similarly to your example when the PHP script is in a single-byte encoding where € is an invalid UTF-8 string, such as ISO-8859-15.
 [2010-09-14 11:25 UTC] danny at studyportals dot eu
This seemed to have solved the test I have set up, but for us, the issue persists.
I will investigate this issue further and try to find out why it is not working 
for me. 

Thank you for your quick responce
 [2010-09-14 11:27 UTC] aharvey@php.net
-Status: Feedback +Status: Bogus
 [2010-09-14 11:27 UTC] aharvey@php.net
Not developer issue -> closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 13:01:34 2025 UTC