HammerAddons
HammerAddons copied to clipboard
Exception occur if map has non-ASCII character in the keyvalue
When the map contain any of non-ASCII character texts in the keyvalue, the postcompiler will throw a exception with following:
[I] postcompiler.main(): Mounting BSP packfile...
[E] logger.except_handler(): Uncaught Exception:
Traceback (most recent call last):
File "hammeraddons\postcompiler.py", line 381, in <module>
File "trio\_core\_run.py", line 2010, in run
File "hammeraddons\postcompiler.py", line 201, in main
File "srctools\bsp.py", line 1303, in __get__
File "srctools\bsp.py", line 2917, in _lmp_read_ents
File "src\\srctools\\_tokenizer.pyx", line 449, in srctools._tokenizer.Tokenizer.__init__
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 275215-275222: surrogates not allowed
[13476] Failed to execute script 'postcompiler' due to unhandled exception!
How to reproduce:
- Create a "game_text" entity.
- Set any of non-ASCII character text to it's "Message Text", for example "--我是中国人--".
- Compile the map with postcompiler and you'll see the exception.
If you remove the minus sign and leave only non-ASCII character, the text will be automatic removed by vbsp and make keyvalue empty.