UTF8 to rtf (php)

my rtf never showed üÜ etc correct(was created by Microsoft word), so here comes the fix! (no help for chinese letters etc)

/**
 * @param $word in utf-8 encoding
 */
function utf82rtf($word){
    //does not work with multibyte
    $word = mb_convert_encoding($word,'ISO-8859-15','UTF-8');

    $out='';
    for($i=0;$i125)$out.="\\u$code\\'".dechex($code);//pre 125 = readable
        else $out.=$letter;
    }
    return $out;
}

Social Bookmark
Kommentieren