php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50693 UTF-8 characters not displayed correctly in browser
Submitted: 2010-01-08 16:46 UTC Modified: 2010-01-09 18:40 UTC
From: ilian dot box at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.1 OS: Windows XP SP3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ilian dot box at gmail dot com
New email:
PHP Version: OS:

 

 [2010-01-08 16:46 UTC] 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:
--------------
Лили Иванова

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-09 18:40 UTC] jani@php.net
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.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 21:00:01 2026 UTC