Answer the question
In order to leave comments, you need to log in
php, one more time about encoding
The essence of the subject is as follows.
There is an icecast2 server (this is an audio broadcasting server), it has a page where information about channels is displayed.
By means of php I take away the name of the current track and here the problem waits.
And it lies in the fact that songs with Cyrillic names look something like this - "Alina Grosu - Chalk on asphalt".
I need it to be normal utf-8. I tried the Lebedev decoder - it converts from cp1252 to cp1251.
I tried it myself both through iconv and through mb_character_encoding to convert from cp1252 to utf-8 = even more terrible kryakozyabry is obtained.
______________
So I'm asking the habra community for advice - maybe there is some kind of solution?
Answer the question
In order to leave comments, you need to log in
"Alina Grosu - Chalk on asphalt" - what encoding does it come to you?
If it's a single-byte encoding, then you need
$string = iconv('cp1251', 'utf-8', $string);
$string = iconv('utf-8', 'cp1252', $string);
$string = iconv('cp1251', 'utf-8', $string);
and yes, you need to convert CP1252 → CP1251 → UTF-8 (or immediately CP1252 → UTF-8), not UTF-8 → CP1252, as you do ...
mb_detect_encoding($str); defines the encoding. Just used it myself.
I know it's been 3 years, but I'm sure someone else will come in handy!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question