Error "invalid byte sequence in utf-8" when using INI_ENCODING #112

Open
opened 2015-06-19 01:57:01 +00:00 by chosenofbear · 1 comment
chosenofbear commented 2015-06-19 01:57:01 +00:00 (Migrated from github.com)

I am trying to run a RMXP game with Chinese title. If I do not compile mkxp with INI_ENCODING, it will throw the error "invalid byte sequence in utf-8" immediately when I start the game. If I compile rmxp with INI_ENCODING, the title can be displayed, but the same error again is thrown when the game's customized script starts reading the ini file:

file = File.open('Game.ini','r')
file.each {|line|
line.gsub!(/\n/,"") #error when reading the line with Chinese title in Game.ini
...

This does not happen with the original RMXP Game.exe.

I am trying to run a RMXP game with Chinese title. If I do not compile mkxp with INI_ENCODING, it will throw the error "invalid byte sequence in utf-8" immediately when I start the game. If I compile rmxp with INI_ENCODING, the title can be displayed, but the same error again is thrown when the game's customized script starts reading the ini file: file = File.open('Game.ini','r') file.each {|line| line.gsub!(/\n/,"") #error when reading the line with Chinese title in Game.ini ... This does not happen with the original RMXP Game.exe.
Ancurio commented 2015-06-19 02:08:46 +00:00 (Migrated from github.com)

Hmm, so the ini file is not UTF-8 but some Chinese encoding, but Ruby in mkxp always expects to be dealing with UTF-8. The RMXP RGSS dll probably has a work-around to deal with Chinese encoded files.

The fix seems easy enough, either convert the ini to UTF-8 with your favorite text editor, or put the ini contents directly into the script instead of having them read from the ini.

Hmm, so the ini file is not UTF-8 but some Chinese encoding, but Ruby in mkxp always expects to be dealing with UTF-8. The RMXP RGSS dll probably has a work-around to deal with Chinese encoded files. The fix seems easy enough, either convert the ini to UTF-8 with your favorite text editor, or put the ini contents directly into the script instead of having them read from the ini.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: MapleShrine/mkxp#112
No description provided.