AGS 4.0 - Alpha 23 for public test

Started by Crimson Wizard, Thu 01/06/2023 14:00:59

Previous topic - Next topic

eri0o

What property is TextProperties? Do you mean specifically Custom Properties? Where is the "é" character used? Is it in the value? Can you show a screenshot of what happens?

Crimson Wizard

#401
Quote from: Baguettator on Yesterday at 06:17:17Small issue concerning TextProperties : for hotspots, if I use the 'é' letter, after closing the editor and relaunch it, the letter is not normally displayed in game (nor in the editor in fact). Seems to be a formating issue.

Entering `é` letter in Hotspot description turns into what seems like a utf-8 combination of characters after reloading the game.
Same occurs to the Room Object's description.
Same occurs to the custom property values in the hotspots and objects.

At the same time, non-room objects, like Characters, work fine.

This does not seem to happen in 3.6.2.

A quick guess: this is related to the new room serialization in ags4. Possibly something is missing or broken in their serialization of text properties of the room elements.

EDIT: These texts look correct inside Room's data.xml, and it's saved as UTF-8. Which means that they get broken when loading rooms back into the editor.

EDIT2: It turned out that all this time AGS 4 Editor was loading rooms in ANSI mode. Any unicode text in room data (not scripts) was lost.

eri0o

Uhm, from looking at SerializeUtils (the last lines of the file), it looks like we manually insert the UTF8 declaration, but looking this stackoverflow answer, it looks like there is a way to set so itself will write such header somehow? Also, from the comments in this question in SO, it seems that .NET uses UTF-16 strings by default? (I may be misunderstanding)

Crimson Wizard

#403
Quote from: eri0o on Yesterday at 15:33:51Uhm, from looking at SerializeUtils (the last lines of the file), it looks like we manually insert the UTF8 declaration, but looking this stackoverflow answer, it looks like there is a way to set so itself will write such header somehow? Also, from the comments in this question in SO, it seems that .NET uses UTF-16 strings by default? (I may be misunderstanding)

RoomComponent was using its own procedure, where it loaded xml as bytes furst, and then converted these bytes to text using "default encoding", which is current ANSI codepage. Hence utf-8 was lost in the process.

EDIT: Yes, .NET uses UTF-16 strings in memory. Whenever we save or load text, we have to convert between our format and UTF-16.


EDIT2:
Actually, I am confused by the manual addition of UTF-8 as well. Need to compare this with the 3.* version, because the encoding should depend on the "Text format" property in the project (so long as we still support ASCII mode).

Baguettator

Oh my mistake, I'm sorry, I wrote so quickly that I again forgot to precise some informations...

Yes it's about Customproperties, applying to Hotspots. It seems Crimson has identified the problem though, so glad to see that it has been found :)

Crimson Wizard

I fixed this texts problem, but there's a significant change coming along, so it's better to wait until the proper update release.

SMF spam blocked by CleanTalk