Error "invalid byte sequence in utf-8" when using INI_ENCODING #112
Labels
No Label
RGSS accuracy
bug
compilation
discussion
documentation
duplicate
enhancement
invalid
performance issue
port request
question
ruby incompatibility
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MapleShrine/mkxp#112
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
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.