Javascript escape() per PHP zurückwandeln

Gerade hatte ich bei Sajax das Problem, Daten, welche mit der Javascript Funktion escape() vor der Übertragung zum Server „behandelt“ wurden, wieder zu in PHP dekodieren. Was haben die sich eigentlich dabei gedacht, das charset des Dokuments zu ignorieren, Zeichen, die in Latin-1 sind, als %xx zu escapen und den Rest als %uxxxx ?

public static function unutf8escape($str) {
$str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",utf8_encode(urldecode($str)));
return html_entity_decode($str,null,'UTF-8');;
}

Dieser Beitrag wurde unter Software, Websoftware veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.


Warning: Declaration of sk2_captcha_plugin::output_plugin_UI() should be compatible with sk2_plugin::output_plugin_UI($output_dls = true) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_plugins/sk2_captcha_plugin.php on line 60

Warning: Declaration of sk2_pjw_simpledigest::output_plugin_UI() should be compatible with sk2_plugin::output_plugin_UI($output_dls = true) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_plugins/sk2_pjw_daily_digest_plugin.php on line 210

Warning: Declaration of sk2_rbl_plugin::treat_this($cmt_object) should be compatible with sk2_plugin::treat_this(&$cmt_object) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_plugins/sk2_rbl_plugin.php on line 227

Warning: Declaration of sk2_referrer_check_plugin::output_plugin_UI() should be compatible with sk2_plugin::output_plugin_UI($output_dls = true) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_plugins/sk2_referrer_check_plugin.php on line 70

Warning: Use of undefined constant after - assumed 'after' (this will throw an Error in a future version of PHP) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_core_class.php on line 314

Warning: Use of undefined constant after - assumed 'after' (this will throw an Error in a future version of PHP) in /is/htdocs/wp1153128_S7O04BK1JT/www/blog/wp-content/plugins/SK2/sk2_core_class.php on line 314