General ESMJ Forum

romaji names in two-byte ascii

画像 Gordon Bateson
romaji names in two-byte ascii

Hello everybody,

here is a little fix I developed so that any romaji names that are entered in double−byte ascii [double-byte ascii] will be converted to single byte ascii. You can also adjust the names to be "UPPER CASE", "lower case" or "Proper Case".

  • upload the attached "two-byte.js" file into the "moodle/user" folder on your Moodle site
  • using a text editor, add the folllowing line to the bottom of "moodle/user/edit.html"
    <script type="text/javascript" language="javascript" src="two-byte.js""></script>

The default case settings are:

  • first name: Proper
  • last name: UPPER
  • city: Proper

If you want to change the case settings, you can edit the settings at the bottom of the "two-byte.js" file.

I also added a feature which converts certain romaji spellings my students use, to the romaji equivalents that I personally prefer.

  • SYA, SYO and SYU -> SHA, SHO and SHU
  • JYA, JYO and JYU -> JA, JO and JU
  • ZYA, ZYO and ZYU -> JA, JO and JU
  • TI -> CHI
  • ZI -> JI
  • OU and OO -> O
  • UU -> U
  • NN -> N
  • HU -> FU

My apologies if you disagree with these defaults. You are free to delete or change them, by editing the "standardize romanization" section in "two-byte.js".

The attached "two-byte.js" file is encoded as EUC-JP, so as to fit in with the standard "ja" language pack for Moodle. If you wish to edit it using a computer with a different default encoding (i.e. a Windows computer) you will have to use a text editor that can handle EUC-JP. Windows "Notepad" and "Wordpad" are not up to the task, so I use (and can recommend) "Terapad", available free from

best regards

画像 Don Hinkelman
Re: romaji names in two-byte ascii
Hi Gordon,

This is a lovely fix that will be extremely useful in my school sites.  Many novice students enter romaji names in two-byte mode which causes annoying trouble.  Also I like the choices you made on the romanisation.  However, I will probably choose to use "Proper" as a family/last name setting (Where does the customary UPPER family name come from?).  And a note for Mac users, Textwrangler is a very good, free text editor (it also has FTP built in, so you can edit files remotely).