I have a string on a variable $str after successfully decrypting AES cipher with mcrypt_decrypt. If I try to print str to screen, I do notice that it has a blank space between each letter, that actually is a NULL termination (\x00) given by UTF-16 character encoding.
Array
(
[1] => 33
[2] => 0
[3] => 34
[4] => 0
[5] => 35
[6] => 0
...
)
I've tried many ways to turn it into UTF-8 but I failed. What can I do?
You should use mb-convert-encoding function
$str = mb_convert_encoding($str, "UTF-8" , "UTF-16LE");
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