<?php

//## перекодировка win1251 -> unicode (UTF-8)
//## Тоже самое что и выше, только нет экономии места...

function win_utf8 ($in_text){
$output="";
$other[1025]="Ё";
$other[1105]="ё";
$other[1028]="Є";
$other[1108]="є";
$other[1030]="I";
$other[1110]="i";
$other[1031]="Ї";
$other[1111]="ї";

for (
$i=0$i<strlen($in_text); $i++){
if (
ord($in_text{$i})>191){
  
$output.="&#".(ord($in_text{$i})+848).";";
} else {
  if (
array_search($in_text{$i}, $other)===false){
   
$output.=$in_text{$i};
  } else {
   
$output.="&#".array_search($in_text{$i}, $other).";";
  }
}
}
return 
$output;
}
?>