Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of special characters #135

Closed
falkokoetter opened this Issue Jul 20, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@falkokoetter
Copy link

falkokoetter commented Jul 20, 2013

I checked out easy rpg to use the import/export of maps between xml and lmu format.
Map events containing special characters (e.g. german umlauts ÄÖÜäöü) are read fine to XML, but when converting back to lmu something goes wrong and the map can't be read.
I located the issue in the method

void RawStructRPG::EventCommand::WriteLcf(const RPG::EventCommand& event_command, LcfWriter& stream)

in the file ldb_eventcommand.cpp

As I understand it, the maker prefixes each String with its length in characters
This is done with the command

stream.WriteInt(event_command.string.size());

However, as special characters take more than one byte, the count is wrong (In lmu it is only one byte, probably encoded in Windows-1252 ).

To fix this, you could use w_char or some sort of different count.

It is possible that the same error happens with other strings written to lmu.

Contact me if you need more details.
hexcomp

@Ghabry

This comment has been minimized.

Copy link
Member

Ghabry commented Jul 20, 2013

Thanks for tracking this down. We already encountered savegame corruption in another German game (Düsterburg) and couldnt figure out why. This could be the reason.

Please try:

- stream.WriteInt(event_command.string.size());
+ stream.WriteInt(stream.Decode(event_command.string).size());

RPG::EventCommand::WriteLcf(const RPG::EventCommand& event_command, LcfWriter& stream)

Note that we have two different issue trackers (one for Player, one for Readers).

Related: EasyRPG/liblcf#31

Looks also wrong twice in
void RawStructRPG::MoveCommand::WriteLcf(const RPG::MoveCommand& ref, LcfWriter& stream)

@falkokoetter

This comment has been minimized.

Copy link
Author

falkokoetter commented Jul 20, 2013

I tested it and it works like a charm.
Thank you very much!

Those two places you mentioned need to use

stream.WriteInt(stream.Decode(ref.parameter_string).size());

as well, otherwise the same error occurs with a charset or sound file name conatining special characters.

@Ghabry

This comment has been minimized.

Copy link
Member

Ghabry commented Jul 20, 2013

Thanks for testing. Will submit a fix to upstream.

Edit: Looks like I compiled expat for Windows wrong. I cant even read our XML files ;) (Unknown encoding error), have to resolve this first...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.