![]() |
|
![]() | ||
|
Subject:
Converting ISO-2022-JP to Unicode in PHP
Category: Computers > Programming Asked by: alexander-ga List Price: $18.00 |
Posted:
15 Jul 2003 04:41 PDT
Expires: 15 Jul 2003 16:25 PDT Question ID: 231193 |
Given this: =?iso-2022-jp?B?GyRCPi5AbhsoQg==?= (note that that's exactly what I have, there's no < ASCII 32 chars in there) In PHP, how do I convert it (and other such ISO-2022-JP strings) to something more useful? (i.e. UTF-8 or, preferably, Unicode character entities) I have iconv installed, and if it's the right command to use, I must be doing something wrong, because I can only get it to spit out exactly what I put in. |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: Converting ISO-2022-JP to Unicode in PHP
From: maitrella-ga on 15 Jul 2003 10:34 PDT |
just my two cents... http://si.php.net/manual/en/ref.mbstring.php http://si.php.net:8888/manual/en/function.mb-convert-encoding.php /* Convert ISO-2022-JP to UTF-8 */ $str = mb_convert_encoding($str, "UTF-8", "ISO-2022-JP"); Good luck ! |
Subject:
Re: Converting ISO-2022-JP to Unicode in PHP
From: vladimir-ga on 15 Jul 2003 15:22 PDT |
alexander, You can convert a string from ISO-2022-JP to Unicode using the iconv() function, like so: $output_sting = iconv("ISO-2022-JP", "UTF-8", $input_string); But your string looks like it's also encoded with base64. You can decode it using the base64_decode() function. (I think it takes a string without the leading "=?iso-2022-jp?B?" as a parameter, just "GyRCPi5AbhsoQg==?=" in this case, you'd have to test it.) Here is the documentation for those two functions: http://www.php.net/manual/en/function.iconv.php http://www.php.net/manual/en/function.base64-decode.php |
Subject:
Re: Converting ISO-2022-JP to Unicode in PHP
From: alexander-ga on 15 Jul 2003 16:23 PDT |
Spot-on, vladimir. Thank you. If I have my Base64 knowledge right, the actual encoded data is "GyRCPi5AbhsoQg==" (4-byte chunks with = as a pad), but base64_decode seems to just ignore any extra junk, so it also works just as you've written it. Good luck in becoming a researcher, if that's your goal. You've got my vote. :) |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |