Fix Base64 or find alternative
I'm using Base64 to encode a preferences cookie. The problem is with the o-slash character (ø) or ø. When I encode and then decode it with PHP I get: \xc3\xb8 I think this has to do with ANSI or UTF-8. Is there a good alternative to Base64? I'm not too much worried about size. Yes, I know the difference between hash, encode, and encrypt. I also tried Hexadecimal to no avail. Base32, while it probably wouldn't work, would be too slow. I hope that there is a workaround for this.
You may be able to use mb_convert_encoding():
(Change "UTF-8" to whatever the actual character set is you want to use -- though I recommend UTF-8 if possible.)
$decoded = mb_convert_encoding( $string, "UTF-8", "BASE64" );
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread