Sure.
Here is the functions. They worked fine in my other plugin but I’ll still need to go over them line by line…
// Character Encoding Input
$eci_o42chars['in'] = array(
chr(196), chr(228), chr(214), chr(246), chr(220), chr(252), chr(223)
);
$eci_o42chars['ecto'] = array(
'???', '???', '???', '???', '???', '???', '???'
);
$eci_o42chars['html'] = array(
'Ä', 'ä', 'ö', 'ö', 'Ü', 'ü', 'ß'
);
$eci_o42chars['utf8'] = array(
utf8_encode('???'), utf8_encode('???'), utf8_encode('???'), utf8_encode('???'),
utf8_encode('???'), utf8_encode('???'), utf8_encode('???')
);
$eci_o42chars['perma'] = array(
'Ae', 'ae', 'Oe', 'oe', 'Ue', 'ue', 'ss'
);
// Character Encoding Ouput
$eci_o42chars['post'] = array(
'???', '???', '???', '???', 'Uuml;', '???', '???'
);
$eci_o42chars['feed'] = array(
'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', 'ß'
);
# Applys Encoding To Entire $my_post Object Based On Settings
function eci_postencoding( $csv,$my_post,$set ){
// title encoding
if( isset( $set['titleencoding'] ) && $set['titleencoding'] != 'None' )
{
if( $set['titleencoding'] == 'UTF8Standard' )
{
$my_post['title'] = utf8_encode( $my_post['title'] );
}
elseif( $set['titleencoding'] == 'UTF8Full' )
{
$my_post['title'] = eci_encodingclean_content( $my_post['title'] );
}
}
// post content encoding
if( isset( $set['contentencoding'] ) && $set['contentencoding'] != 'None' )
{
if( $set['contentencoding'] == 'UTF8Standard' )
{
$my_post['title'] = utf8_encode( $my_post['title'] );
}
elseif( $set['contentencoding'] == 'UTF8Full' )
{
$my_post['title'] = eci_encodingclean_content( $my_post['title'] );
}
}
// permalink encoding
if( isset( $set['permalinkencoding'] ) && $set['permalinkencoding'] != 'None' )
{
if( $set['permalinkencoding'] == 'UTF8Standard' )
{
$my_post['title'] = utf8_encode( $my_post['title'] );
}
elseif( $set['permalinkencoding'] == 'UTF8Full' )
{
$my_post['title'] = eci_encodingclean_permalinks( $my_post['title'] );
}
}
return $my_post;
}
# Converts Special Characters Using Correct Encoding Values For Permalinks
function eci_encodingclean_permalinks($title){
global $eci_o42chars;
if ( seems_utf8($title) )
{
$invalid_latin_chars = array(chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', chr(197).chr(160) => 'S', chr(197).chr(189) => 'Z', chr(197).chr(161) => 's', chr(197).chr(190) => 'z', chr(226).chr(130).chr(172) => 'E');
$title = utf8_decode(strtr($title, $invalid_latin_chars));
}
$title = str_replace($eci_o42chars['ecto'], $eci_o42chars['perma'], $title);
$title = str_replace($eci_o42chars['in'], $eci_o42chars['perma'], $title);
$title = str_replace($eci_o42chars['html'], $eci_o42chars['perma'], $title);
$title = sanitize_title_with_dashes($title);
return $title;
}
# Converts Special Characters Using Correct Encoding Values For Content
function eci_encodingclean_content( $content) {
global $eci_o42chars;
if ( strtoupper( get_option('blog_charset' )) == 'UTF-8')
{
$content = str_replace($eci_o42chars['utf8'], $eci_o42chars['feed'], $content);
}
$content = str_replace($eci_o42chars['ecto'], $eci_o42chars['feed'], $content);
$content = str_replace($eci_o42chars['in'], $eci_o42chars['feed'], $content);
return $content;
}