Php code conversion

Source: Internet
Author: User
Php code conversion
\ XC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91

How can I convert it into a Chinese character?


Reply to discussion (solution)

It seems like a password. I don't know what encoding encryption is. only people who write code can know that even if they know the password, it seems to be a secondary encryption.

$a = '\xC3\xA6\xC2\x9D\xC2\x8E\xC3\xA5\xC2\x86\xC2\xAC\xC3\xA5\xC2\x8F\xC2\x91';$a = str_split($a,4);$b = '';foreach ($a as $key => $value) {$b.= chr(hexdec($value));}var_dump(iconv('gbk', 'utf-8',$b));


If the result is incorrect, the encoding problem occurs.

Header ('content-type: text/html; charset = utf-8 '); $ s = "\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 "; echo iconv ('utf-8', 'latin1', $ s ); // It must have been read from the database $ s = '\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 '; $ s = str_replace ('\ X', '', $ s); echo iconv ('utf-8', 'latin1', hex2bin ($ s ));
Li Dongfa

He is the moderator of this forum.

Moderator,

% C3 % A4 % C2 % B8 % C2 % 89% C3 % A5 % C2 % 8A % C2 % A0 % C3 % A4 % C2 % B8 % C2 % 80

How can this be solved?

Diverse and knowledgeable

$s = '%C3%A4%C2%B8%C2%89%C3%A5%C2%8A%C2%A0%C3%A4%C2%B8%C2%80';echo iconv('utf-8', 'latin1', urldecode($s));
Three plus one

% C3 % A4 % C2 % B8 % C2 % 89% C3 % A5 % C2 % 8A % C2 % A0 % C3 % A4 % C2 % B8 % C2 % 80

How can this be solved?

header('Content-type: text/html;charset=utf-8');$a = "%C3%A4%C2%B8%C2%89%C3%A5%C2%8A%C2%A0%C3%A4%C2%B8%C2%80";echo iconv('utf-8', 'latin1', urldecode($a));

@ Moderator

\ XC3 \ xA5 \ xC2 \ xAD \ xC2 \ x9F \ xC3 \ xA6 \ xC2 \ xB3 \ xC2 \ xA2321

-\ XC3 \ xA5 \ xC2 \ x85 \ xC2 \ x94 \ xC3 \ xA5 \ xC2 \ xAD \ xC2 \ x90-

T \ xC3 \ xA5 \ xC2 \ xBE \ xC2 \ x85 \ xC3 \ xA9 \ xC2 \ xB8 \ xC2 \ xBF

These codes are mixed with normal numbers and letters. if you use hex2bin, an error is returned.

Will not get the processing result

On the third floor, the moderator V5, and then the diapers. Learning,

@ Moderator

\ XC3 \ xA5 \ xC2 \ xAD \ xC2 \ x9F \ xC3 \ xA6 \ xC2 \ xB3 \ xC2 \ xA2321

-\ XC3 \ xA5 \ xC2 \ x85 \ xC2 \ x94 \ xC3 \ xA5 \ xC2 \ xAD \ xC2 \ x90-

T \ xC3 \ xA5 \ xC2 \ xBE \ xC2 \ x85 \ xC3 \ xA9 \ xC2 \ xB8 \ xC2 \ xBF

These codes are mixed with normal numbers and letters. if you use hex2bin, an error is returned.

Will not get the processing result

header('Content-type: text/html;charset=utf-8');$s = "\xC3\xA5\xC2\xAD\xC2\x9F\xC3\xA6\xC2\xB3\xC2\xA2321-\xC3\xA5\xC2\x85\xC2\x94\xC3\xA5\xC2\xAD\xC2\x90-t\xC3\xA5\xC2\xBE\xC2\x85\xC3\xA9\xC2\xB8\xC2\xBF";echo iconv('utf-8', 'latin1', $s);
This is acceptable.





Header ('content-type: text/html; charset = utf-8 '); $ s = "\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 "; echo iconv ('utf-8', 'latin1', $ s ); // It must have been read from the database $ s = '\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 '; $ s = str_replace ('\ X', '', $ s); echo iconv ('utf-8', 'latin1', hex2bin ($ s ));
Li Dongfa

The moderator mentioned it for the first time. it does not use double quotation marks. you know the reason.

In this way, writing is more general.

$s = '\xC3\xA5\xC2\xAD\xC2\x9F\xC3\xA6\xC2\xB3\xC2\xA2321 -\xC3\xA5\xC2\x85\xC2\x94\xC3\xA5\xC2\xAD\xC2\x90- t\xC3\xA5\xC2\xBE\xC2\x85\xC3\xA9\xC2\xB8\xC2\xBF';$f = create_function('', "return \"$s\";");echo iconv('utf-8', 'latin1', $f());
Meng Bo 321

-Rabbit-

T waiting for Hong

This can also be done, but some people are jealous of eval.

$s = '\xC3\xA5\xC2\xAD\xC2\x9F\xC3\xA6\xC2\xB3\xC2\xA2321 -\xC3\xA5\xC2\x85\xC2\x94\xC3\xA5\xC2\xAD\xC2\x90- t\xC3\xA5\xC2\xBE\xC2\x85\xC3\xA9\xC2\xB8\xC2\xBF';echo iconv('utf-8', 'latin1', eval("return \"$s\";"));

Thanks to the omnipotent Masters (moderators), Amen ~


Header ('content-type: text/html; charset = utf-8 '); $ s = "\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 "; echo iconv ('utf-8', 'latin1', $ s ); // It must have been read from the database $ s = '\ xC3 \ xA6 \ xC2 \ x9D \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x86 \ xC2 \ xAC \ xC3 \ xA5 \ xC2 \ x8F \ xC2 \ x91 '; $ s = str_replace ('\ X', '', $ s); echo iconv ('utf-8', 'latin1', hex2bin ($ s ));
Li Dongfa

The moderator mentioned it for the first time. it does not use double quotation marks. you know the reason.

Isn't it enough to replace single quotes with double quotes?

@ Microlab2009

You don't know the application, not what you said.

For example, the following logs need to extract the value of the un parameter.

36.32.251.206--[13/Feb/2014: 10: 44: 57 + 0800] "GET/s.gif? H = aa.aa.com & sid = 139225950488782186 & at = Mozilla/5.0% 20 (compatible; % 20 MSIE % 2010.0; % 20 Windows % 20NT % 206.2; % 20 Trident/6.0; % 20. NET4.0E; % 20. NET4.0C; % 20InfoPath. 2; % 20.NET% 20CLR % 203.5.30729; % 20.NET% 20CLR % 202.0.50727; % 20.NET% 20CLR % 203.0.30729) & w = 1422 & h = 800 & re = http://www.aa.com/s?wd=%25E5%258D%2595%25E7%2589%2587%25E6%259C%25BA%25E4%25B8%258D%25E7%2594%25A8%25E7%259A%2584IO%25E9%2585%258D%25E7%25BD%25AE%25E8%25BE%2593%25E5%2585%25A5%25E8%25BF%2598%25E6%2598%25AF%25E8%25BE%2593%25E5%2587%25BA%25E5%25A5%25BD&rsv_bp=0&ch=&tn= ** & Bar = & rsv_spt = 3 & ie = UTF-8 & rsv_sug3 = 31 & rsv_sug4 = 1371 & rsv_sug1 = 6 & rsv_sug2 = 0 & inputT = 3 & url = http://aa.aa.com/icview-328428-1-1.html & T = 0 & asr = & un = \ xC3 \ xA5 \ xC2 \ x8D \ xC2 \ x81 \ xC3 \ xA5 \ xC2 \ xB9 \ xC2 \ xB4 \ xC3 \ xA5 \ xC2 \ x90 \ xC2 \ x8E \ xC3 \ xA5 \ xC2 \ x85 \ xC2 \ xAB \ xC3 \ xA6 \ xC2 \ x9C \ xC2 \ x88 HTTP/1.1 "200 43" http://aa.aa.com/icview-328428-1-1.html "" Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0 )""-"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.