convert KOI8-R to UTF8

11,791

Solution 1

You can use mb_convert_encoding:

$output = mb_convert_encoding($input, 'UTF-8', 'KOI8-R');

Solution 2

$output = iconv('KOI8-R', 'UTF-8', $input);

also worked :)

There is also the option for it to remove corrupt or unrecognized characters

iconv("KOI8-R", "UTF-8//IGNORE", $text)

But you need iconv to be installed.

Share:
11,791
Timo Huovinen
Author by

Timo Huovinen

"The formulation of a problem is often more essential than its solution, which may be merely a matter of mathematical or experimental skill." -Albert Einstein Web Dev that enjoys HTML/CSS, but mainly works with JavaScript, Golang, PHP and SQL. Considers himself to be a beginner forever, even though has experience in the field, the fact that he is self-taught shows with constant beginner questions. Talks about himself in third person. Lacks common sense.

Updated on June 08, 2022

Comments

  • Timo Huovinen
    Timo Huovinen almost 2 years

    I need to convert a KOI8-R encoded string into plain UTF8