ID: 37724
Updated by: hirokawa@php.net
Reported By: oylbqelmhfbxzg at mailinator dot com
-Status: Verified
+Status: Closed
Bug Type: mbstring related
Operating System: Linux
PHP Version: 4.4.2
Assigned To: hirokawa
New Comment:
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
If strict mode detection is used in PHP 5.2.3,
both results are ISO-8859-1.
<?php
$string1 = "testö";
echo mb_detect_encoding($string1,'UTF-8, ISO-8859-1', true);
// returns UTF-8
echo " ";
$string2 = "testöe";
echo mb_detect_encoding($string2,'UTF-8, ISO-8859-1', true);
// returns ISO-8859-1
?>
Previous Comments:
------------------------------------------------------------------------
[2007-08-17 22:32:39] hirokawa@php.net
It is also happend in PHP 5.2.
------------------------------------------------------------------------
[2007-02-21 11:28:24] gabriel at unisolution dot de
I read that
mb_detect_encoding($string,array('ISO-8859-1','UTF-8'));
always return ISO-8859-1.
Try this;
<?php
$string1 = "testö";
echo mb_detect_encoding($string1,'UTF-8, ISO-8859-1');
// returns UTF-8
echo " ";
$string2 = "testöe";
echo mb_detect_encoding($string2,'UTF-8, ISO-8859-1');
// returns ISO-8859-1
?>
(php 4.4.0)
------------------------------------------------------------------------
[2006-09-14 22:48:09] hirokawa@php.net
Could you show me mbstring part of php.ini ?
And please show me the simple script to verify your ploblem.
I executed this tiny script, and if forks fine.
(with Fedora Linux 5, PHP 5.1.5)
<?php
$string = "testö";
echo mb_detect_encoding($string,array('ISO-8859-1','UTF-8'));
// returns ISO-8859-1
?>
------------------------------------------------------------------------
[2006-07-23 12:05:59] sniper@php.net
Rui, does this exist also in PHP 5.x branches/HEAD?
If so and this is real bug, update the version. :)
------------------------------------------------------------------------
[2006-06-07 08:54:27] oylbqelmhfbxzg at mailinator dot com
Description:
------------
Since bug 36994 was closed..
Both
$string = "testö"
in a utf-8 text file, and
$string = "testö"
in an iso-8859-1 file (converted using iconv) return "UTF-8" with
mb_detect_encoding, even when strict is on.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37724&edit=1