victords / super-bombinhas

A 2D platformer written in Ruby.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when change language, a crash occurred

diogo-vf opened this issue · comments

Hello,
Nice game!
When I test to change language the game crash with the next error:

Traceback (most recent call last):
        22: from game.rb:158:in `<main>'
        21: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gosu-0.15.2-x64-mingw32/lib/gosu/patches.rb:78:in `tick'
        20: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gosu-0.15.2-x64-mingw32/lib/gosu/patches.rb:78:in `tick'
        19: from game.rb:127:in `draw'
        18: from E:/Prog/super-bombinhas/menu.rb:227:in `draw'
        17: from E:/Prog/super-bombinhas/form.rb:296:in `draw'
        16: from E:/Prog/super-bombinhas/form.rb:296:in `each'
        15: from E:/Prog/super-bombinhas/form.rb:296:in `block in draw'
        14: from E:/Prog/super-bombinhas/form.rb:238:in `draw'
        13: from E:/Prog/super-bombinhas/form.rb:238:in `each'
        12: from E:/Prog/super-bombinhas/form.rb:238:in `block in draw'
        11: from E:/Prog/super-bombinhas/form.rb:81:in `draw'
        10: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:235:in `write_breaking'
         9: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:235:in `each'
         8: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:246:in `block in write_breaking'
         7: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:256:in `write_paragraph'
         6: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:256:in `each'
         5: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:257:in `block in write_paragraph'
         4: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:63:in `markup_width'
         3: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:63:in `reduce'
         2: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:63:in `each'
         1: from E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:63:in `block in markup_width'
E:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/minigl-2.3.3/lib/minigl/text.rb:63:in `index': incompatible character encodings: UTF-8 and CP850 (Encoding::CompatibilityError)

hi,
i can see english, portuguese and spanish.
but on the interface, when i want switch to spanish or portuguese the app crash before to show the selected language.
the error message show bad encoding.

i've checked with VScode all files and it shows UTF-8 🤔 i don't understood where the error is coming from...

it's a configuration of my computer
image

and I have record how i have test your game :) (but the first time i've played 20 min on level)
my video

Actually @DiogoVieiraFerreira , looking at the stack trace I think maybe the problem is with the encoding of the source files!
Can you check the encoding of the "global.rb" file?

hi i use ruby 2.6.5 and i've pull your code on github.
i've test on 2 pc and the bug is the same.

Did you check the encoding of the "global.rb" source file? I believe it must be different from UTF-8, which is the encoding of the strings files...

i've check all files on project and all files are on UTF-8 encoding and the sequence of end of line is CRLF.

ok i've check with a newer ruby version... the problem is the version.
i can change language and the app not crash

please specify on your install your ruby version ;)

Hey, I was able to reproduce your problem when I installed Ruby 2.6.5 with the default settings, but I got it working by marking the option "Use UTF-8 as the default external encoding".
It's not an issue with the version itself (version 2.6.5 works fine on Linux and on Windows with this setting). Also, the Ruby version is set in the Gemfile - the game should work with any version of Ruby >= 2.0.