Skoro próbowałem htmlspecialchars to chyba logiczne, że inne funkcje z tej dziedziny też wypróbowałem

Koniec końców częściowym rozwiązaniem tego problemu jest funkcja:
function win1252toIso( $string ) {
// These chars seem to be not contained
// in php's CP1252 translation table
142 => "Ž",
158 => "ž"
);
// Go through string and decide char by char:
// "leave as is or build entity?"
$newStr = "";
for( $i=0; $i < strlen( $string ); $i++ ) { $ord = ord( $string[$i] );
// build entity using extra translation table
$newStr .= $extensions[$ord];
}
else {
// build entity using php's translation table
// or leave as is
$newStr .= ( $ord > 127 && $ord < 160 ) ?
: $string[$i];
}
}
return $newStr;
}
Aczkolwiek dla tekstu wpisanego w stronę, a żeby przesłać formularz muszę pobawić się w zmienianie znaków z poziomu JS - (strona na AJAXie).
W każdym razie temat do zamknięcia :-)
EDIT:Mam już pełne rozwiązanie także dla JSa :-)
Kod
replaceWordChars = function(text) {
var s = text;
s = s.replace(/[\u2018|\u2019|\u201A]/g, "\'");
s = s.replace(/[\u201C|\u201D|\u201E]/g, "\"");
s = s.replace(/\u2026/g, "...");
s = s.replace(/[\u2013|\u2014]/g, "-");
s = s.replace(/\u02C6/g, "^");
s = s.replace(/\u2039/g, "<");
s = s.replace(/\u203A/g, ">");
s = s.replace(/[\u02DC|\u00A0]/g, " ");
return s;
};