I am aware that there were some similar problems. However after reading answers and gooling about the topic I am still struggling with displaying Russian letters in the browser. I have them stored inside .csv file (which is encoded in UTF-8 no BOM). In my php file which reads .csv (which is also encoded in UTF-8 no BOM) I declared charset:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
To open and iterate through .csv file I am using following code:
if(($handle = fopen($path, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
...
}
}
and either nothing is displayed or something like this:
-ам-Зее
instead of
Целль-ам-Зее
Any ideas what else I can try?
UPDATE:
After setting browser encoding to UTF-8 I get correct russian letters. However still some of the text is not displayed at all. I suspect that I do something incorectly while reading .csv file, the simplified version is:
if(($handle = fopen($path, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
echo $data[1];
}
}
( I omit first column and display the content of the second one, which is always filled )
You need to set correct locale on your server.
And then you can check if your server has accepted needed locale
The problem is in fgetcsv function which is using incorrect locale. If you have no possibility to change locale you could replace fgetcsv function with your own using explode