Reputation: 853
what is type this encoding?
"\x73\164\x6f\x72\141\147\145\x3a\154\x69\x6e\153"
How to encode "storage:link"
string as above encode?
Upvotes: 0
Views: 253
Reputation: 9029
Your string is a mixture of hexadecimal and octal representation of "storage:link":
\x73\164\x6f\x72\141\147\145\x3a\154\x69\x6e\153
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
hex oct hex hex oct oct oct hex oct hex hex oct
According to this comment, you may convert your binary string into hex represented text like this:
$hexStr = bin2hex("storage:link"); // 73746f726167653a6c696e6b
$hexStr = chunk_split($hexStr, 2, '\x'); // 73\x74\x6f\x72\x61\x67\x65\x3a\x6c\x69\x6e\x6b\x
$hexStr = '\x' . substr($hexStr, 0, -2); // \x73\x74\x6f\x72\x61\x67\x65\x3a\x6c\x69\x6e\x6b
The final output would be:
\x73\x74\x6f\x72\x61\x67\x65\x3a\x6c\x69\x6e\x6b
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
hex hex hex hex hex hex hex hex hex hex hex hex
Upvotes: 1