An app wants me to insert strings as text encoded using hex values in proper coding.
, the encoding being Unicode_No_Compression
For example, for Sześć siedem
the correct HEX string is 0053007A0065015B0107002000730069006500640065006D
,Źdźbło
= 01790064017A00620142006F
String with no special chars
=0053007400720069006E0067002000770069007400680020006E006F0020007300700065006300690061006C002000630068006100720073
I tried playing with MySQL HEX()
/UNHEX()
and dechex()
PHP, but been unable to figure out how to make this conversion. Any ideas?
You're essentially looking at the hex version of the UCS-2 encoding, I'm guessing. Therefore:
php > echo strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', 'Źdźbło')));
01790064017A00620142006F
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With