Use PHP interpretation JavaScript escape () encoded strings

xiaoxiao2021-03-06  33

PHP is HTML Encoding in HTML ENCODING, which is similar, but it is still slightly different, so it cannot be rotated.

The difference between the two can be referred to: http://php.weblogs.com/php_jscript_vbscript_1

The record is as follows:

PHP: Urlencode () All puncture, accented character, and any other Non-ASCII Characters Are Replaced with% xx encoding. Spaces Converted To .

URLDECode () All puncture, accented character, and any other non-ascii characters are replaced with% xx encoding. Spaces Converted To .

JavaScript: Escape (STR) All Spaces, Puncture, Accented Characters, and any other non-ascii characters are replaced with% xx encoding

How do you use PHP to read the strings encoded by Escape ()?

You can read the following ways (example is Unicode interpretation to BIG5)

Modify itself: http://vivian.stripper.jp/index.php? Itemid = 100

$ Str = Unidecode ($ STR, 'BIG-5');

Function Unidecode ($ TEXT = preg_replace_callback ("/% U [0-9A-ZA-Z] {4} /", Array (& $ this, "TOUTF8"), $ STR); RETURN MB_CONVERT_ENCODING ($ TEXT, $ Charcode, 'UTF-8');} Function Toutf8 ($ A) {Foreach ($ AR AS $ VAL) {$ VAL = Intval (Substr ($ VAL, 2), 16); IF $ VAL <0x7F) {@ 00 00. = CHR ($ VAL);} elseif ($ VAL <0x800) {@ 0080-0800 $ c. = CHR (0xc0 | ($ VAL / 64)) $ c. = CHR (0x80 | ($ VAL% 64));} else {// 0800-fff $ c. = CHR (0xE0 | (($ VAL / 64) / 64)); $ c. = chr (0x80 | (($ VAL / 64)% 64)); $ c. = CHR (0x80 | ($ VAL% 64));}}}}}}}}} Return $ C;}

转载请注明原文地址:https://www.9cbs.com/read-64649.html

New Post(0)