about | contact | rss
programming The only command you'll ever need
 
  The only command you'll ever need

mb_convert_encoding seems to be the command I'm using the most at work just now, I've programmed PHP for 5 years before and its the first time I've heard of it, then again I didn't write applications in another language for 5 years either....

<?php
/* Convert internal character encoding to SJIS */
$str mb_convert_encoding($str"SJIS");

/* Convert EUC-JP to UTF-8 */
$str mb_convert_encoding($str"UTF-8""EUC-JP");

/* Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE */
$str mb_convert_encoding($str"UCS-2LE""JIS, eucjp-win, sjis-win");

/* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
$str mb_convert_encoding($str"EUC-JP""auto");
?>

Just look at those conversions go !

=)



Post a comment
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

 

 
 
Posted by sasqwach at December 1, 2004 8:19 PM | Permalink
Recent
articles - 4
books - 7
comedy - 8
comics - 2
culture - 20
food - 10
gaming - 10
living - 18
media - 4
music - 9
parody
programming - 4
sex - 3
study - 9
tech - 7
toys
travel - 13
tv & film - 7
work - 11
Archive a
3 8 7 6 4
5 5 5