Version 4.05 adds more support for Unicode, in particular UTF-8 encoded strings.
It is difficult for me to extensively test these, as I generally use the "normal" Western characters, but these changes seem to be a step in the right direction.
- A check of the code revealed that there were various places where the UTF-8 flag was not honoured when compiling regular expressions. These have been fixed.
- UTF-8 support was inadvertently removed from version 4.03 - it is now back in.
- You can specify UTF-8 codes by using regular expressions, for example:
match: ^\x{198}\x{19c}$
This matches the (hex) Unicode characters 0198 and 019c.
- For testing triggers there is now a "Insert Unicode" button in the "Debug Simulated World Output" dialog. This lets you easily insert UTF-8 sequences into your debug strings. For example, by using that I quickly converted the characters 0198 and 019C into \C6\98\C6\9C for testing the trigger.
- New script routines for Lua scripting:
- utf8encode - encodes a sequence of Unicode numbers into UTF-8.
- utf8decode - decodes a UTF-8 string into its appropriate Unicode numbers
- utf8valid - checks if a UTF-8 string is valid
- utf8encode - encodes a sequence of Unicode numbers into UTF-8.
It is difficult for me to extensively test these, as I generally use the "normal" Western characters, but these changes seem to be a step in the right direction.