Shift_JIS

The page is encoded in Shift_JIS but could be encoded in another charset such as UTF-8 as well.
The sgf file is encoded in Shift_JIS but could be encoded in another charset such as UTF-8 as well.
The sgf file must be encoded in the charset specified in its CA property (the most important).
The maxiGos js scripts themselves are encoded in UTF-8 (no good reason to change this).

Because the page is not in UTF-8, the key point is to use charset="UTF-8" in the script tags that load the js scripts (<script charset="UTF-8" src="...">).

Start by loading the localization script "mgos-loc-ja.js" (for japanese).

maxigos-comment.js

Load the maxiGos script "maxigos-comment.js".
Read the sgf file "Mingren-001-1F-1-ja.sgf" (game information in japanese).

Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is Shift_JIS.
Step 2: maxiGos transforms the sgf file content from Shift_JIS to UTF-8.
Step 3: the browser detects that the page is in Shift_JIS and the script tags have charset="UTF-8".
Step 4: the browser transforms maxiGos output (strings that are displayed on the screen) from UTF-8 to Shift_JIS.
Step 5: maxiGos displays its labels in japanese (using mgos-loc-ja.js code).

maxigos-edit.js

Load the maxiGos script "maxigos-edit.js".
Read the sgf file "Mingren-001-1F-1-ja.sgf" (game information in japanese).

By default, maxiGos generates sgf in "UTF-8". But here, when the user clicks on the "Sgf" button or selects the "Save" menu, the charset in the CA property of the sgf is "Shift_JIS" because we set the value of the "toCharset" parameter to "Shift_JIS" using data-maxigos-to-charset="Shift_JIS" as attribute of the script tag that loads the player. Another method could be to add in the code of the player mxG.D[mxG.K].toCharset="Shift_JIS"; just before mxG.D[mxG.K].createAll();.

Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is Shift_JIS.
Step 2: maxiGos transforms the sgf file content from Shift_JIS to UTF-8.
Step 3: the browser detects that the page is in Shift_JIS and the script tags have charset="UTF-8".
Step 4: the browser transforms maxiGos output (strings that are displayed on the screen) from UTF-8 to Shift_JIS.
Step 5: maxiGos displays its labels in japanese (using mgos-loc-ja.js code).
Step 6: if the user clicks on the "Sgf" button, maxiGos looks at the value of the "toCharset" parameter and sees that it is "Shift_JIS" and not "UTF-8".
Step 7: maxiGos replaces the CA property of the sgf by "Shift_JIS" then displays the sgf.