1 | | Noz doesn't seem to have page create permissions, so just creating this as a placeholder for him to edit. |
| 1 | = UTF-8 and Wide-character handling in Angband = |
| 2 | |
| 3 | == Background == |
| 4 | |
| 5 | As of the sequence of commits from 589d1d3 to c91ae22, (plus a few bug-fixes and cleanups since) the Angband source is able to handle UTF-8 characters in its edit files, and has dropped the previous hacky mechanism of generating accented characters (with sequences like ["e] for ë). |
| 6 | |
| 7 | There are a number of changes that had to happen for this to work, and this page aims to document them. |
| 8 | |
| 9 | == Locale == |
| 10 | |
| 11 | Angband now needs to be run within a UTF-8 capable locale, and this is checked in '''main.c''':''main()'', as: |
| 12 | {{{ |
| 13 | if (setlocale(LC_CTYPE, "")) { |
| 14 | /* Require UTF-8 */ |
| 15 | if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) |
| 16 | quit("Angband requires UTF-8 support"); |
| 17 | } |
| 18 | }}} |
| 19 | |
| 20 | == Files == |
| 21 | |
| 22 | All the edit files are now expected to be in the UTF-8 encoding, and can have accented characters directly inserted in them. |
| 23 | Output files such as spoilers, character dumps and other text output is now in UTF-8. |
| 24 | |
| 25 | (What about screen dumps?) |
| 26 | |
| 27 | == Internals == |
| 28 | |
| 29 | === "Canvas" === |
| 30 | |
| 31 | === Textblock === |
| 32 | |
| 33 | === Parsers === |
| 34 | |
| 35 | In reading the edit files, all strings are maintained in UTF-8 until needed. |
| 36 | Glyphs are read in directly to a wchar_t type. |
| 37 | |
| 38 | == Ports == |
| 39 | |
| 40 | This section lists port-specific changes and what the individual ports do with the wide-char representation of the display characters to get them onto the display. |
| 41 | |
| 42 | === SDL === |
| 43 | |
| 44 | === X11 === |
| 45 | |
| 46 | === GCU === |
| 47 | |
| 48 | === Windows === |
| 49 | |
| 50 | === OSX === |
| 51 | |
| 52 | === GTK === |
| 53 | |
| 54 | === Android === |