This page is encoded in Big5 but could be encoded in another charset
such as UTF-8 as well.
The sgf file is encoded in Big5 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 "maxigos-i18n-zh-hant.js" (for traditionnal chinese).
Use "comment.php" script.
Read the sgf file "Mingren-001-1F-1-zh-hant-Big5.sgf"
(in this file, CA is Big5 and game information is in traditionnal chinese).
Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is Big5.
Step 2: maxiGos transforms the sgf file content from Big5 to UTF-8.
Step 3: the browser detects that the page is in Big5 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 Big5.
Step 5: maxiGos displays its labels in traditionnal chinese (using maxigos-i18n-zh-hant.js script).
Use "edit.php" script.
Read the sgf file "Mingren-001-1F-1-zh-hant-Big5.sgf"
(in this file, CA is Big5 and game information is in traditionnal 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 "Big5" because we set the value of the "toCharset" parameter to "Big5" using data-maxigos-to-charset="Big5" as attribute of the script tag that loads the player.
Setp 1: maxiGos reads the sgf file, looks at its CA property and sees that it is Big5.
Step 2: maxiGos transforms the sgf file content from Big5 to UTF-8.
Step 3: the browser detects that the page is in Big5 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 Big5.
Step 5: maxiGos displays its labels in traditionnal chinese (using maxigos-i18n-zh-hant.js script).
Step 6: if the user clicks on the "Sgf" button, maxiGos looks at the value of the "toCharset"
parameter and sees that it is "Big5" and not "UTF-8".
Step 7: maxiGos replaces the CA property of the sgf by "Big5" then displays the sgf.