|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-09 18:40 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 17:00:01 2026 UTC |
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: -------------- Лили Иванова