« tokyo tidbits |
Main Page
| ilya and loop drop »
Doing it this way requires that the browser has the Japanese character set installed (which is easy to do for MSIE or Mozilla/Netscape) ...but I might consider instead translating the japanese characters to a series of small gifs for those who are not willing to install the character set (like Shoduka). I -am- lazy though.
Comments:
JIS X 0208 decoding
Posted by dav at 2002 December 8 02:05 PM
File under: Geek
File under: Geek
I hacked up some perl code that will process the emails Mie sends me from her cell phone and translate the JIS X 0208 character set into Unicode HTML Entities.
#look for the JIS X 0208-1983 enocded block
# (see http://lfw.org/text/jp.html#iso2022)
while ($message =~ /(\x1b\x24\x42)(.+)(\x1b\x28\x42)/) {
$encoded = $2;
$message =~ s/\x1b\x24\x42//;
$message =~ s/\x1b\x28\x42//;
$unicodeEntities = &decode( $encoded );
$message =~ s/$encoded/$unicodeEntities/;
}
view full code
Doing it this way requires that the browser has the Japanese character set installed (which is easy to do for MSIE or Mozilla/Netscape) ...but I might consider instead translating the japanese characters to a series of small gifs for those who are not willing to install the character set (like Shoduka). I -am- lazy though.
Post a new comment:
Thanks for signing in, . Now you can comment. (sign out)
(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.)
You go, code warrior.
Posted by: Laura on December 10, 2002 07:34 AM