I'm having issue with storing Swedish characters in DB, so I tried everything possible, and nothing worked. As the last option, I decided to store every Swedish character as HTML entity, using function like:
function fix_swed_chars($s){
$s = trim($s, " \n\t\r");
$ss = "";
for($i = 0; $i < strlen($s); $i++){
$x = ord($s[$i]);
if ($x > 125){
if ($x != 160)
$ss .= "&#$x;";
else $ss .= " ";
} else $ss .= $s[$i];
}
return trim($ss);
}
That works just fine in some cases, but here is he issue: "Äntligen" for example is stored as "Äntligen" which means that "Ä" is actually recognized by php as 2 characters.