Wednesday 30 July 2003

Japanese Text

これは日本語のテキストです。読めますか?

If the characters above look like the ones in this illustration

Japanese text: kore wa nihongo no tekisuto desu. yomemasu ka? (This is Japanese text. Can you read it?)

then you have Japanese support installed or enabled in your OS. If not, and you’d like to be able to see the Japanese characters, you’ll need to install or enable Japanese support.

Jim Breen, coordinator of the EDICT Project (Japanese-English dictionary), has a helpful Japanese page, with lots of information about his various dictionary projects and Japanese computing (from which I’ve extracted some of the following links).

Note that the processes for enabling Chinese and/or Korean support are similar to those described for Japanese.

Reading Japanese text on a Windows PC

If you are using a non East Asian version of Windows, the procedure for setting up your PC to read and write Japanese depends on the flavor of Windows you are running.

Users of Windows 95/98/ME must install the Microsoft Global IME (Input Method Editor) and associated fonts. Users of Windows 2000 and Windows XP Pro do not have to download the IME or fonts, although they will need to install them since they are not installed by default.

The most complete set of instructions is available at:

Side-by-side instructions for Windows XP Pro and Windows 2000 are available at:

Reading Japanese text on a Macintosh

Although I started using Japanese on the Macintosh in the late eighties, I haven’t used a Macintosh for a long time. These instructions will probably be enough to get you going:

Reading Japanese text on a Linux system

Japanese just seemed to work automatically when I installed Red Hat Linux. Information about Japanese support in SuSE Linux, which—according to Jim Breen—applies to other Linux distributions too, is available here:

Creating CJK content in Movable Type

Publishing Movable Type posts containing CJK characters is a little more complicated. There is some background material in Trevor Hill’s post Asian Languages… and mine on Enabling CJK Language Support (particularly the comments). In summary, you will need to:

  1. Modify your mt.cfg file so that MT does not use the Perl module HTML::Entities to encode characters into HTML entities.
  2. Modify mt.cfg to override the default character encoding (based on your “Preferred Language.”
  3. Modify the send_http_header in lib/MT/App.pm as suggested by Trevor Hill in the MT forum.

Specifically, you will need to:

  1. Find the line in mt.cfg that says
    # NoHTMLEntities 1
    and remove the # so that it reads
    NoHTMLEntities 1
  2. Find the line in mt.cfg that says
    # PublishCharset Shift_JIS
    and modify it to read
    PublishCharset UTF-8
  3. Find the sub send_http_header code block in lib/MT/App.pm and replace it with:
    sub send_http_header {
    my $app = shift;
    my($type) = @_;
    $type ||= 'text/html; charset=utf-8';
    # if (my $charset = $app->{charset}) {
    # $type .= "; charset=$charset"
    # if $type =~ m!^text/! && $type !~ /\bcharset\b/;
    # }
    if ($ENV{MOD_PERL}) {
    $app->{apache}->send_http_header($type);
    } else {
    $app->{cgi_headers}{-type} = $type;
    print $app->{query}->header(%{ $app->{cgi_headers} });
    }
    }

After that, all you have to do is generate CJK text in a Unicode-compliant application and paste it into MT’s Entry field.

Permalink | Technorati

Comments

Ah, excellent tutorial, Jonathon. Does this signal your return to blogging?

Posted by John on 7 August 2003 (Comment Permalink)

Actually, I think you have to work at it to keep Japanese support from being installed on a Mac OS X system. Japanese support there is wonderful. My wife's iBook just worked correctly. She set Japanese as her preferred language and hasn't looked back since.

Posted by Will Leshner on 8 August 2003 (Comment Permalink)

Same for Korean. When I gave my TiBook to my wife, all I had to do was to select Korean as the main language...

Welcome back, by the way...

Posted by dda on 8 August 2003 (Comment Permalink)

Your wife got a TiBook my wife got an iBook. Let's just keep this between ourselves, shall we :)

Posted by Will Leshner on 9 August 2003 (Comment Permalink)

Jonathon,
Had you done any further investigation on the matter of adding a font-family style declaration to specify a particular Japanese font for Windows users?

I've been meaning to look into this more, but haven't yet had the chance. I use Mac OS X myself, so CJK rendering has never been an issue for me, but I have been experimenting with posting in Movable Type both in English and Japanese and I have to say that generally speaking, the Japanese font rendering looks terribly crunchy on every Windows machine I've tested, even under WinXP with ClearType enabled.

ClearType seems to have no effect for non-latin characters, although I can't say I'm surprised. Needless to say if I knew of an alternate Japanese typeface installed by the global IME I'd love to know what it is so I could experiment...

Actually, just responding to this post has inspired me to set about investigating this...

Posted by Brian on 9 August 2003 (Comment Permalink)

John, as I said in my email, you were astonishingly quick off the mark. This entry had only been published a minute or so and you'd left a comment! And, yes, it does signal my return to blogging.

Will and dda, it looks like you guys have established the essential rule for the intercultural CJK marriage: give one's wife (or husband) a Macintosh laptop. I'll start saving now so that, when I meet the Japanese woman of my dreams, I can walk straight to nearest Apple store. (If I'm lucky though, she might already have a Mac. As my father once told me: "One can just as easily fall in love with a rich girl as a poor girl.")

Brian, I'm ashamed to admit that it had never occurred to me to add "a font-family style declaration to specify a particular Japanese font for Windows users." So much for my CJK-aware credentials. Easy enough to do though, since I've already defined CLASS styles to render the Japanese text at different sizes. I'm pretty sure that under Windows you get the choice of MS Gothic or MS Mincho, whether you've installed the IME or enabled Japanese for Win 2K or Win XP.

I might be getting this wrong, but your question implies that the Japanese text looks superior on the Macintosh. That doesn't surprise me at all but I'm led to ask: in what font is the Japanese text on this page rendered on your Macintosh? If you can give me a list of Japanese fonts that are installed under OS X, we can play around with modifying my stylesheet to see which looks best.

Uh, oh! Once more, I hear the siren call to buy a Macintosh. I thought I'd resolved this issue once and for all. Did Will, AKMA, or Norm Jenson put you up to this?

Posted by Jonathon on 9 August 2003 (Comment Permalink)

The name of the default font for rendering Japanese text in the browser on Mac OS X is Osaka. But OS X includes another set of Unicode fonts for Japanese text, in various weights. These three faces are:

ヒラギノ明朝 (Hiragino Mincho)
ヒラギノ丸ゴ (Hiragino Maru Gothic)
ヒラギノ角ゴ (Hiragino Kaku Gothic)

Mozilla allows you to specify a default font for each of the languages your OS supports; other Mac browsers don't provide this level of customization (though you can specify with CSS of course), and all will default to using Osaka.

It looks like MS Mincho is the Windows font IE uses, but I'm not certain (there may be others). I've tried viewing Japanese pages using the latest release of Mozilla, and it renders Japanese text quite differently. But without a bit more digging, I'm not sure if Mozilla is using a different font (either IME-installed or Mozilla-installed) or if Moz's text rendering method is simply sufficiently different that it only appears to be using different typeface.

As for my implication that OS X renders text better, I suppose it could be a matter of taste, but OS X does smoothly anti-alias non-Latin fonts, and I've yet to see IE6/Win do this.

I can send you some screenshots of how your Japanese text here renders in OS X, if you'd like. It looks delecious. =)

Posted by Brian on 10 August 2003 (Comment Permalink)

Brian, a few months ago, when I was fantasizing about buying a new iBook, I had a look at how Mac OS X rendered Japanese fonts. Kevin Marks (http://epeus.blogspot.com/) even went to the trouble of sending me a screen shot:

http://weblog.delacour.net/archives/000823.html

You're absolutely right, they are delicious. But I can't afford a Macintosh. And I don't really need one. So all I can say to you is: "Get thee behind me, Satan."

Posted by Jonathon on 10 August 2003 (Comment Permalink)

[Removed (off-topic)]

Posted by Jake Gang on 6 September 2003 (Comment Permalink)

[Removed (off-topic)]

Posted by Julie Newcomer on 6 September 2003 (Comment Permalink)

email me the japenese alhabet please

Posted by laura on 8 November 2003 (Comment Permalink)

[Removed (duplicate)]

Posted by laura on 8 November 2003 (Comment Permalink)

[Removed (duplicate)]

Posted by laura on 8 November 2003 (Comment Permalink)

[Removed (duplicate)]

Posted by laura on 8 November 2003 (Comment Permalink)

please e-mail me the alphabet i heard alot of japenese.also i read a book of"Sadako and the thousand paper cranes"did you ever hear that storie?that is a good storie hope you have a great year best wishes ffom me thank you remember my e-mail is "chrismendozag@yahoo.com that @ is one of those a for e-mail heres an easy way it is on top of your two
THANK YOU
from a nice person called Kris

Posted by Kris on 13 January 2004 (Comment Permalink)

This discussion is now closed. My thanks to everyone who contributed.

© Copyright 2007 Jonathon Delacour