I was doing a small task on php (Even tried the same task on cold-fusion).
There is an API that sends me URL of following Pattern as a data:
http://127.0.0.1:8080/test/index.php?brand=%93%FA%8EY%8E%A9%93%AE%8E%D4
http://127.0.0.1:8080/test/index.php?brand=Airtel%20India%20Mobile%20Corporation
I have to display the brand name, which is crucial part of the task. When I simply prints brand name as:
echo $_GET['brand']
, than I am getting correct output for URL 2.
URL 2 prints Airtel India Mobile Corporation.
However, I am getting wrong output for 1. URL 1 prints weird set of characters. Please Note URL-1 brand contains name of a Japanese company(Nissan Motor Co., Ltd.) in Japanese.
URL 1 : echo prints
“úŽYŽ©“®ŽÔ
I realized its an encoding problem. Then What I did is:
Right-Clicked on IE->Selected Encoding-> Selected Japanese(Shift_JIS) as Encoding.
As soon as I selected Japanese(Shift_JIS), I got the correct output.
日産自動車
How can I do it using PHP (and/or) Cold-Fusion? In other words, how can I display correct/desired o/p by PHP( or coldfusion) code (script).
Any help is appreciated.