php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52910 PHP iconv() behaves differently than "iconv" command
Submitted: 2010-09-23 00:37 UTC Modified: 2010-09-23 02:59 UTC
From: ms419 at freezone dot co dot uk Assigned:
Status: Not a bug Package: ICONV related
PHP Version: 5.3SVN-2010-09-22 (snap) OS: Debian unstable
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ms419 at freezone dot co dot uk
New email:
PHP Version: OS:

 

 [2010-09-23 00:37 UTC] ms419 at freezone dot co dot uk
Description:
------------
I confirmed that both PHP and the "iconv" command use glibc

In the POSIX ("C") locale, "iconv" successfully transliterates "e" with an accent ("\xc3\xa9") to "e" with no accent,

$ LC_ALL=C echo -e "\xc3\xa9" | iconv -f utf-8 -t ascii//TRANSLIT 
e
$ 

 - however in the same locale, PHP iconv() fails to transliterate "e" with an accent,

$ LC_ALL=C sapi/cli/php -r 'var_dump(iconv("utf-8", "ascii//TRANSLIT", "\xc3\xa9"));'
string(1) "?"
$ 



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-23 02:59 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-09-23 02:59 UTC] cataphract@php.net
LC_ALL is only affecting "echo".

You must do:

LC_ALL=C iconv -f utf-8 -t ascii//TRANSLIT 

Closing as bogus as this is almost certainly the cause of the problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC