Marco Floriano wrote in post #1016136: > C:\Ruby192\bin\ruby.exe -e $stdout.sync=true; > $stderr.sync=true;load($0=ARGV.shift) C:/Users/Sandbox.Marco-PC/ > RubymineProjects/TempApp/main.rb > C:/Users/Sandbox.Marco-PC/RubymineProjects/TempApp/main.rb:25:in `<top > (required)>': incompatible character encodings: UTF-8 and IBM437 > (Encoding::CompatibilityError) Well, here it says the problem is in line 25 of main.rb. The screenshot said it was in line 32 of main.rb. So the first thing is: can you identify what line that is? The code you pasted in had only 25 lines. The rules for encodings in ruby 1.9.x are labyrinthine. I tried to understand them once: see https://github.com/candlerb/string19/blob/master/string19.rb However it appears that your application is using UTF-8 for the source encoding (for string literals), and IBM437 for text read from files, and then it sometimes crashes when these two meet. The source encoding is UTF-8 because you declared it thus in the #encoding line. This part at least is sane. The encoding for data read from files is IBM437 because ruby has silently guessed this, based on settings in your environment. You can either meddle with your environment to fix the problem - however your program will then work on your machine but may not work on someone else's. Or you can change your code to something like this: arquivo = File.readlines("pagina.html", :encoding=>"UTF-8") Unfortunately, ruby doesn't "crash early" for errors like this. Without this incantation, your program will sometimes work and sometimes crash, depending on the data you feed into it. I cannot stand ruby 1.9 for this reason. Fortunately for me, ruby 1.8 still exists. -- Posted via http://www.ruby-forum.com/.