From: "S. Hieko" Date: 2012-10-02T08:05:38+09:00 Subject: Re: Windows XP - Path encoding problem prevents script execution Thanks Jon and Damián. I'm sorry I got confused with all the trial and error. I had removed temporarily the "gets" statement while launching via windows explorer. The code page regkey change does indeed modify the explorer's behaviour (and so it works!). The code page trick was the right thing to do. The garbage output was solved with the font change as suggested. So for anyone googling here is what worked for me: 1. Add the "#encoding: utf-8" magic tag at the top of the script. This forces string output to UTF8 whatever happens. 2. Save the file in **UTF-8** encoding. Otherwise it seems the ruby interpreter will try to interpret the bytes of the string (as they are inside the text file) as if they were utf8 encoded. 3. Append to any strings representing paths with accents, etc. the method ".encode('Windows-1252')". This seems to be necessary for the same reason as the code page change was needed. For instance I had a weird error : although a path variable had been declared at the top of the script, failure occured later on while I was appending a path value to an array inside a block. It's the only way I could use the "require" statement as well. 1 and 2 are necessary to have consistency (for instance irb and pry return different strings encoding). I could bypass 1, 2 and 3 by just specifying the magic tag "#encoding: Windows-1252" at the start of the script by since I'm parsing external data I chose not to. Thanks again for your help! -- Posted via http://www.ruby-forum.com/.