php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49231 iconv doesn't handle iso-8859-15 well
Submitted: 2009-08-12 10:30 UTC Modified: 2009-08-13 08:47 UTC
From: jochem dot blok at fasterforward dot nl Assigned:
Status: Not a bug Package: ICONV related
PHP Version: 5.2.10 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jochem dot blok at fasterforward dot nl
New email:
PHP Version: OS:

 

 [2009-08-12 10:30 UTC] jochem dot blok at fasterforward dot nl
Description:
------------
iconv doenst handle iso-8859-15 well. See http://en.wikipedia.org/wiki/ISO/IEC_8859-15. The reproduce code gives ? and that should be ?. Its seems that iconv converts to ISO-8859-1

Reproduce code:
---------------
echo iconv('utf-8','ISO-8859-15',html_entity_decode(utf8_encode('€'),null, 'UTF-8'));

Expected result:
----------------
?

Actual result:
--------------
?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-12 11:37 UTC] sjoerd-php at linuxonly dot nl
Thank you for your bug report.

I was unable to reproduce the problem. Are you sure that PHP outputs the wrong character? It could be the tool you use to view the output has a problem displaying the euro character. Try the following code:

echo bin2hex(iconv('utf-8','ISO-8859-15', html_entity_decode('€', null, 'UTF-8'))); // should output a4.
 [2009-08-12 11:45 UTC] jochem dot blok at fasterforward dot nl
When I try this: 

<?
header('content-type: text/html; charset=ISO-8859-15');
echo iconv('utf-8','ISO-8859-15',html_entity_decode(utf8_encode('&euro;'),ENT_QUOTES, 'UTF-8'))
?>

It works in a browser. Debugging in Zend Studio gives the wrong character. It seems that Zend Studio uses the editor encoding or something like that. When I change the encoding (under Desktop) to ISO-8859-15 it works!

Your snippet also gives a4, which is correct in both the browser and Zend Studio.

It seems to be an Zend Studio issue :) Thanks for pointing me to the solution.
 [2009-08-13 08:47 UTC] jani@php.net
And as it's not PHP bug -> bogus. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC