#50693 [Opn->Bgs]: UTF-8 characters not displayed correctly in browser
ID: 50693
Updated by: jani@php.net
Reported By: ilian dot box at gmail dot com
-Status: Open
+Status: Bogus
-Bug Type: *Unicode Issues
+Bug Type: *General Issues
Operating System: Windows XP SP3
PHP Version: 5.3.1
New Comment:
First of all: your script is crap. Please provide a script that
actually shows your problem. And check your mysql settings..that's where
the problem really is.
Previous Comments:
------------------------------------------------------------------------
[2010-01-08 16:46:17] ilian dot box at gmail dot com
Description:
------------
My application runs on Apache 2.2 with MySQL 5.1.34-community database
server and PHP 5.3.1.
Prior to switching to PHP 5.3.1 I had PHP 5.2.9-2 and did NOT
experience the problem I am descibing now.
My database tables store text in UTF-8 encoding. Before being stored to
the database, the text is converted to UTF-8.
The problem is related to failing to properly display Cyrillic text in
the browser. Instead, the text is displayed as is in UTF-8, i.e.
Ðили Ðванова.
By using utf8_decode() I've managed to display correctly most of the
lowercase characters and few of the uppercase ones. Many are not
recognized and are substituted with a rhomb and a quastion mark.
I have to point out that this problem did not exist when I was running
PHP 5.2.9-2. All Cyrillic text was properly displayed.
I have tried the following in any combinations without success:
mb_internal_encoding("UTF-8");
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
mb_detect_order("UTF-8,ASCII");
ob_start('mb_output_handler');
Reproduce code:
---------------
<?php
header("Content-type: text/html; charset=utf-8");
/* $string1 represents the value taken from the database.
Unfortunately when rendering this string in code by hardcoding as it
is now, but not retrieving it
from the database, still does not display correctly (it must be
Ðили Ðванова).
*/
$string1 = "Ðили Ðванова";
$string2 = "Ðили Ðванова; // The string as it should be
displayed
echo $string1;
echo '<br>';
echo $string2;
echo '<br>';
echo utf8_decode($string1); // Partial solution
?>
Expected result:
----------------
The value of the variable $string1 should be displayed as Ðили
Ðванова
Actual result:
--------------
Ðили Ðванова
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50693&edit=1
Thread (2 messages)