开发者

Whats the difference and how to generate these two encodings?

I am working with these two encoding type of strings:

%ueb08%u8b09%u3c40%u5756%u5ebe%u3440%u408d
\x26\x04\x9e\x8e\xf9\xd0

To generate the first type I found this function:

function encoder(s)
{
    $res = strtoupper(bin2hex($s));
    $g = round(strlen($res)/4);
    if($g != (strlen($res)/4)) 
    $res .= "00"; 
    $out = "";
    for($i = 0; $i < strlen($res); $i += 4) 
    $out .= "%u"开发者_如何学Go . substr($res, $i + 2, 2) . substr($res, $i, 2);
    return $out;
}

Now I need to convert the first type of strings, to the second type, which I don't even know what type of encoding it is. How could I do that?


The bottom is just standard notation for representing hex values in the ascii space.

If you want the number 0, it is \x00, if you want 10, it would be \x0A, and 16 (hex's 10) is \x10 (15 would be \x0F)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜