the LuaJIT runtime is patched to understand paths in UTF-8,
API functionality like FileSearch yields paths encoded in UTF-8,
GetScriptPath/GetUserPath yields paths in UTF-8,
text rendering draws glyphs that don't exist in the fonts as [U+1234] "tofu" in a smaller font size,
mouse selection understands codepoint boundaries,
a compiled extension lua-utf8 is exposed to the Lua side.
This means that Lua code that touches things like the full build path or the script path may need to adapt to process UTF-8 correctly with string operations.
In order to help with that, the SimpleGraphic update also features luautf8, a Lua extension that provides UTF-8 analogues of many string operations like gsub, match, etc.
This change leverages that extension via local utf8 = require('lua-utf8') to correctly move the text caret with the cursor keys in edit controls, and also showcases its use to handle (hypothetical) Unicode decimal and thousands separators.
The runtime also lost the vestigial ability to process GIF and BLP image formats, some existing assets were stealth GIFs with PNG extensions and have here been converted lossless to PNG.
The update check logic has been adapted to generate relative paths in the op-files to make its limited interpreter work correctly in exotic install locations.
Steps taken to verify a working solution:
Install location:
install PoB into a location with traditionally unrepresentable Japanese characters in an English locale,
note how it can both start and update itself
Build path:
set the build path to such a location,
note how builds with ASCII characters can still be saved and otherwise modified there.
Build name:
manually create a build XML file with exotic characters outside of PoB,
exercise the build rename, copy and removal UI to see that they still work,
move the text caret around in the build rename UI without splitting any codepoints,
Numeric separators:
artificially set the numeric separators to Unicode codepoints in Settings.xml,
observe how the sidebar and calcs UI draws them correctly.
Description of the problem being solved:
In https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/pull/59 there were significant foundational improvements for users installing Path of Building into paths with characters that cannot be expressed in their codepage.
There is also a companion PR for the Launcher in https://github.com/PathOfBuildingCommunity/PathOfBuilding-Launcher/pull/6.
In short:
GetScriptPath
/GetUserPath
yields paths in UTF-8,[U+1234]
"tofu" in a smaller font size,lua-utf8
is exposed to the Lua side.This means that Lua code that touches things like the full build path or the script path may need to adapt to process UTF-8 correctly with string operations.
In order to help with that, the SimpleGraphic update also features luautf8, a Lua extension that provides UTF-8 analogues of many string operations like
gsub
,match
, etc.This change leverages that extension via
local utf8 = require('lua-utf8')
to correctly move the text caret with the cursor keys in edit controls, and also showcases its use to handle (hypothetical) Unicode decimal and thousands separators.The runtime also lost the vestigial ability to process GIF and BLP image formats, some existing assets were stealth GIFs with PNG extensions and have here been converted lossless to PNG.
The update check logic has been adapted to generate relative paths in the op-files to make its limited interpreter work correctly in exotic install locations.
Steps taken to verify a working solution:
Install location:
Build path:
Build name:
Numeric separators:
Settings.xml
,Link to a build that showcases this PR:
n/a
After screenshot: