The page is encoded in GB18030 but could be encoded in another charset such as UTF-8 as well.
The sgf file is encoded in GB18030 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-zh.js" (for simplified chinese).
Load the maxiGos script "maxigos-comment.js".
Read the sgf file "Mingren-001-1F-1-zh.sgf" (game information in simplified chinese).
Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is GB18030.
Step 2: maxiGos transforms the sgf file content from GB18030 to UTF-8.
Step 3: the browser detects that the page is in GB18030 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 GB18030.
Step 5: maxiGos displays its labels in simplified chinese (using mgos-loc-zh.js code).
Load the maxiGos script "maxigos-edit.js".
Read the sgf file "Mingren-001-1F-1-zh.sgf" (game information in simplified chinese).
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 "GB18030" because we set the value of the "toCharset" parameter to "GB18030" using data-maxigos-to-charset="GB18030" 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="GB18030"; just before mxG.D[mxG.K].createAll();.
Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is GB18030.
Step 2: maxiGos transforms the sgf file content from GB18030 to UTF-8.
Step 3: the browser detects that the page is in GB18030 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 GB18030.
Step 5: maxiGos displays its labels in simplified chinese (using mgos-loc-zh.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 "GB18030" and not "UTF-8".
Step 7: maxiGos replaces the CA property of the sgf by "GB18030" then displays the sgf.