Japanese for Your Mac: Authoring Web Pages in Japanese
Tips on adding Japanese to your own web pages.
If you have experience developing English pages and would like to include some Japanese text, you need a text or html editor or a web page design tool that supports Japanese. (See Page 1 of this site for information on Japanese text entry.) Full-featured editors like Dreamweaver support Japanese, but I use BBedit from BareBones Software and PageSpinner, two text editors optimized for web development, with Japanese support. For other web page editors that can handle Japanese, see the list of unicode savvy Mac web page editors on the Yale Chinese Mac page.)
Now here are just a few tips to get you past some sticking points.
General tips
- On your web page, specify the encoding in a meta tag in the head section:
<meta http-equiv="Content-type" content="text/html; charset=shift_jis"> . The most common flavor of unicode encoding is indicated with charset=utf-8.
- Less critical, but good practice is to specify the language of the page in your html code. You can do this by adding a
lang="en" or lang="ja" attribute to the <html> tag at the start of the file. On a page that is mostly English, you can also specify that one portion is Japanese by adding the lang attribute to a particular element, like this: <p lang="ja">. You can also add it to the span and div elements to designate smaller or larger sections of Japanese text.
- Make sure the ftp program you use to upload the html files is not making any automatic conversions that corrupt the Japanese. If you are using Fetch ver. 4, select Preferences>Misc and make sure "Translate ISO Characters" is not checked. Fetch vers. 5 does not seem to have this problem.
Generating Japanese Pages in Shift JIS with PageSpinner
-
If you include Japanese text, PageSpinner generates pages with the Shift JIS encoding, the most common one for Japanese web pages.
-
If you have accented English characters, as in vis-àvis and garçon, code these using latin character entities like
è and ç or these characters will not display correctly in shift-jis.
-
In PageSpinner set the Filing options (under the edit menu) to "Mac Text" and line feeds to "MAC." In Preferences>Fonts, make sure the the editor display fonts are set to Japanese fonts. The safest seem to be Osaka or Osaka monospace.
Generating Japanese Pages in Shift JIS or Unicode with BBEdit
- Besides Shift JIS and other specifically Japanse encodings, BBEdit also supports unicode, while PageSpinner does not. Unicode allows you to combine English with multiple Asian languages on a single page. (To learn why this is so, see the Encodings Page on this site.) PageSpinner does not support Unicode.
- In fact, BBEdit has so many different flavors of unicode in its encoding menu that it can be confusing which to choose. UTF-8 (with a byte order mark included) seems to be the most common flavor of unicode for html.
- If you are using CSS and external style sheets, be careful about the encoding of the style sheets. Even if your html files are encoded using unicode, your style sheets do not have to be, unless for some reason you want to name your IDs and classes and so forth using non-ascii characters or include Japanese comments in the file. I've found that certain unicode encodings can cause some browsers to be unable to read the style sheet: Some Mozilla browswers seem to generate an error on line 1 and ignore my external style sheets when I accidentally encoded them as UTF-16 with no byte order mark; on the other hand, I've read elsewhere that the presence of a byte order mark can upset the CSS parser too. To be safe I'm setting the encoding of my style sheets to Western (iso-8859-1). You can specify the encoding of an external style sheet just as you can specify it for an html file, but the syntax differs: for CSS, putting the following declaration in the first line of the file:
@charset "iso-8859-1"
Back to Christopher Bolton's Home Page