I have a problem for encoding my data to base64 in php. I want to encode my mail subject which is in Persian with base64_encode function. but I didn’t get expected result. I started to test my base64_encode function.
when I converted ‘سلام’ with PHP the result was ‘0+HH4w==’ and when I tested same thing in http://www.base64encode.org/ web site the result was ‘2LPZhNin2YU=’.
I tried base64_decode(‘2LPZhNin2YU=’) and the output was ‘سلام’
do anybody know why this is happening and how can I fix it?
I have a problem for encoding my data to base64 in php. I want
Share
‘0+HH4w==’ is CP1256 (a.k.a. Windows-1256 http://en.wikipedia.org/wiki/Windows-1256) while ‘2LPZhNin2YU=’ is UTF8.
Just set the charset of your script to windows-1256 and everything should be OK.