larsch/ocra — Issue #42: Ocra fails when script is in a path with funky characters
Author: MatmaRex
Created: 2011-12-29 21:09:48+00:00
State: open

* Ocra 1.3.0
* Ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
* Windows XP SP2
* system encoding Windows-1250, console encoding CP852

Ocra fails when the script it's supposed to compile is in a path containing non-ASCII characters - precisely, this one: ń (I haven't checked any others) . It worked perfectly when I moved everything into another directory without this character.

The error message is:

```
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:54:in `subpath?': incomp
atible encoding regexp match (ISO-8859-2 regexp with Windows-1250 string) (Encod
ing::CompatibilityError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:485:in `blo
ck in find_load_path'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:485:in `sel
ect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:485:in `fin
d_load_path'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:728:in `blo
ck in build_exe'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:727:in `eac
h'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:727:in `bui
ld_exe'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:1138:in `bl
ock in '
```

I've added some debugging into `ocra` file, here are the values of `loadpaths` and `feature` variables in `Ocra.find_load_path` just before the crash:

loadpaths: `[C:/Ruby192/lib/ruby/gems/1.9.1/gems/markaby-0.7.2/lib, /...ń...//warlight tools, C:/Ruby192/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/lib, C:/Ruby192/lib/ruby/gems/1.9.1/gems/progressbar-0.9.1/lib, C:/Ruby192/lib/ruby/gems/1.9.1/gems/savage-1.1.5/lib, C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib, C:/Ruby192/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib, C:/Ruby192/lib/ruby/gems/1.9.1/gems/markaby-0.7.2/lib, C:/Ruby192/lib/ruby/site_ruby/1.9.1, C:/Ruby192/lib/ruby/site_ruby/1.9.1/i386-msvcrt, C:/Ruby192/lib/ruby/site_ruby, C:/Ruby192/lib/ruby/vendor_ruby/1.9.1, C:/Ruby192/lib/ruby/vendor_ruby/1.9.1/i386-msvcrt, C:/Ruby192/lib/ruby/vendor_ruby, C:/Ruby192/lib/ruby/1.9.1, C:/Ruby192/lib/ruby/1.9.1/i386-mingw32]`

feature: `/...ń...//warlight tools/tools/extensions.rb`

I suppose the Ocra::Pathname class could just convert all input to UTF-8 under Ruby 1.9?

The script in question will be put up on my GitHub soon, here: https://github.com/MatmaRex/Warlight-Tools