#29318 [Com]: Can't encode to HTML Entities from UTF-8
| From: | ross at golder dot org | Date: | Mon, 02 Aug 2004 16:08:11 +0000 |
| Subject: | #29318 [Com]: Can't encode to HTML Entities from UTF-8 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63943@lists.php.net to get a copy of this message | ||
ID: 29318
Comment by: ross at golder dot org
Reported By: atlantisboydn at yougotmail dot com
Status: Open
Bug Type: mbstring related
Operating System: Windows XP SP1
PHP Version: 5.0.0
New Comment:
This sounds like a duplicate of :
http://bugs.php.net/bug.php?id=25670
I'm still struggling with this one.
Previous Comments:
------------------------------------------------------------------------
[2004-07-31 12:49:04] atlantisboy at yougotmail dot com
I really don't why noone consider this bug ???
------------------------------------------------------------------------
[2004-07-31 12:41:17] johnmcklein at hotmail dot com
I also face this problem , how to fix it ?
------------------------------------------------------------------------
[2004-07-24 11:15:50] atlantisboy at yougotmail dot com
I also notice that , i retried many times with the same setting .
+Apache1.3.31 , PHP4.3.8
+Apache1.3.31 , PHP5.0.0
+Apache2 , PHP5.0.0
+Apache2 , PHP4.3.8
+Omni 3 Alpha 3 , PHP4.3.8
+Omni 3 Alpha 3 , PHP5.0.0
on Windows XP (SP1) computers and the problems still remain the same
when i use PHP5.0.0 . I believe it's a bug and hope the problem will be
resolved.
------------------------------------------------------------------------
[2004-07-23 15:09:16] atlantisboydn at yougotmail dot com
$mbstring_cfgs = array(
'zlib.output_compression' => '1',
'zlib.output_compression_level' => '9',
'mbstring.detect_order' => 'UTF-8',
'mbstring.http_input' => 'UTF-8',
'mbstring.http_output' => 'UTF-8',
'mbstring.internal_encoding' => 'UTF-8',
'mbstring.script_encoding' => NULL,
'mbstring.substitute_character' => NULL
);
foreach( $mbstring_cfgs as $k => $v )
{
ini_set ($k,$v);
}
$a = @$_POST['txt'];
$a = mb_convert_encoding($a, 'UTF-8','SJIS');
$a = mb_convert_encoding($a, 'HTML-ENTITIES','UTF-8');
echo $a;
=====================================================
Step One : Converting a SJIS encoded string to UTF-8 string . This step
is good , nothing trouble appeared.
Step Two : When convert UTF-8 string ( or whatever multi-byte string )
to HTML ENTITIES . PHP 5.0.0 return a wrong string with uncomplete
entities and strange characters.
I don't face this problem in PHP 4.3.3 RC3.
------------------------------------------------------------------------
[2004-07-23 03:30:52] moriyoshi@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
<?php
$escaped = html_entity_decode('€aä',
ENT_QUOTES, 'UTF-8');
var_dump($escaped);
var_dump(mb_convert_encoding($escaped, 'HTML-ENTITIES',
'UTF-8'));
?>
string(6) "aä"
string(13) "€aä"
Works fine here.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29318
--
Edit this bug report at http://bugs.php.net/?id=29318&edit=1