Home > Backend Development > PHP Tutorial > JQuery AJAX solution for submitting Chinese garbled characters js implements php function urlencode

JQuery AJAX solution for submitting Chinese garbled characters js implements php function urlencode

WBOY
Release: 2016-08-08 09:24:55
Original
1035 people have browsed it

The

encodeURI() function can encode a string as a URI, and the characters will be replaced by hexadecimal escape sequences.
decodeURI() function can decode the URI encoded by encodeURI() function.

The characters after encodeURI() of js are generally encoded in utf-8. If the server-side encoding is a different encoding, iconv conversion is required.
$a = urlencode(iconv("gb2312", "UTF-8", "Movie")); //Equivalent to javascript encodeURI("Movie");
echo $a;
$b = iconv("utf-8","gb2312",urldecode("%E7%94%B5%E5%BD%B1")); //Equivalent to javascript decodeURI("%E7%94%B5%E5%BD% B1");
echo $b;

?>

http://www.2cto.com/kf/201107/95682.html

The above introduces the solution for JQuery AJAX to submit Chinese garbled characters. js implements the php function urlencode, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template