Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems with UTF-8 encoding in PHP

Tags:

php

utf-8

The characters I am getting from the URL, for example www.mydomain.com/?name=john , were fine, as longs as they were not in Russian.

If they were are in Russian, I was getting '����'.

So I added $name= iconv("cp1251","utf-8" ,$name); and now it works fine for Russian and English characters, but screws up other languages. :)))

For example 'Jānis' ( Latvian ) that worked fine before iconv, now turns into 'jДЃnis'.

Any idea if there's some universal encoder that would work with both the Cyrillic languages and not screw up other languages?

like image 934
Roger Travis Avatar asked May 10 '26 02:05

Roger Travis


1 Answers

Why don't you just use UTF-8 with all files and processes?

like image 57
Thiago Belem Avatar answered May 11 '26 14:05

Thiago Belem