drwhut/tabletop-club

Import Log doesn't display non-ASCII characters

GrimPixel opened this issue · 7 comments

Non-ASCII characters are not displayed in the import log if there are errors.

Can you provide a screenshot of this happening?

Here is an example of wrong filename:
non-ascii error
The Cyrillic characters don't show up.

Weird, cyrillic characters seem to work just fine for me:
Screenshot 2023-05-12 at 01 31 20

What version of the game are you running, and where did you download it? What operating system is your system running?

I meant the red message.

I can confirm the text does not display properly in the red messages.

In future, may I ask that you use the bug report template when creating bug reports? A lot of the back-and-forth in this issue could have been mitigated if more information was given at the beginning, e.g. screenshots, reproduction steps.

Ah, I clicked on “New Issue” and signed in, so the selection was skipped. I will use the template.

I think I know what's going on here. I initially thought it was something to do with fonts not loading, but this is not the case. Godot displays the error just fine in the log, but when Tabletop Club receives the error, the non-ASCII characters are then missing:

Loaded: /Users/drwhut/Documents/TabletopClub/assets/Test/cards/config.cfg
ERROR: 'scale' element in entry cannot be negative!
   at: call (modules/gdscript/gdscript_functions.cpp:774)
ERROR: Cannot add entry to AssetDB, entry is invalid!
   at: call (modules/gdscript/gdscript_functions.cpp:774)
ERROR: Parent 'Téßt Привет' for object 'Test 2' does not exist!
   at: call (modules/gdscript/gdscript_functions.cpp:774)
E: 'scale' element in entry cannot be negative!
E: Cannot add entry to AssetDB, entry is invalid!
E: Parent 'Tet ' for object 'Test 2' does not exist!

When push_error is called in GDScript, the string that is passed in is displayed in the log window, and in stderr, as-is. However, after the error has been displayed, the string then gets passed into a series of "error handlers", one of which is in the custom module, and is used by the game in various locations. But these error handlers expect C-style strings, not Godot strings. This is where I think the text is being corrupted: in the hidden conversion from a Godot string to a C string. This should be a relatively easy fix, I just need to make sure the error or warning is stored separately instead of retrieving it from the error handler.