Issue #5447 has been updated by Joël Brogniart.


It's not a thor's bug. It's perhaps an issue related to the way ruby 1.9.3 is configured on Mac OS X. The issue is still there with ruby 1.9.3-p0.

Here is a sample test to see the problem (without using Thor).
In OS X'  Finder create a folder with accented letter in name (i.e. ??milie), create a sub folder in this folder (i.e. toto).
in terminal, cd to the "toto" folder and then irb.

With ruby 1.9.2p290
>> d1 = Dir.getwd
=> "/Users/billgates/Documents/tests/E\314\201milie/toto"
>> d2 = File.expand_path(File.dirname(d1))
=> "/Users/billgates/Documents/tests/E\314\201milie"
>> d1.gsub(d2, '.')
=> "./toto"

With ruby 1.9.3-p0
ruby-1.9.3-p0 :001 > d1 = Dir.getwd
 => "/Users/billgates/Documents/tests/??milie/toto" 
ruby-1.9.3-p0 :002 > d2 = File.expand_path(File.dirname(d1))
 => "/Users/billgates/Documents/tests/??milie" 
ruby-1.9.3-p0 :003 > d1.gsub(d2, '.')
RegexpError: invalid multibyte character: /\/Users\/billgates\/Documents\/tests\/E\xCC\x81milie/
	from (irb):3:in `gsub'
	from (irb):3
	from /Users/billgates/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'

Yours
----------------------------------------
Bug #5447: Rails can't create a new app when a folder with accented letter is in the path
http://redmine.ruby-lang.org/issues/5447

Author: Joël Brogniart
Status: Third Party's Issue
Priority: Normal
Assignee: 
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-10-11 revision 33457) [x86_64-darwin11.2.0]


On OS X Lion 10.7.2
With ruby 1.9.3-RC1 and ruby 1.9.3-head

rvm install 1.9.3-head
rvm --create 1.9.3-head / rails3.1.1
rvm --default use 1.9.3-head / rails3.1.1
gem install rails
cd Documents/EMC/??milie/rails/
rails new test_app

fails with error

/Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions.rb:117:in `gsub': invalid multibyte character: /\/Users\/billgates\/Documents\/EMC\/E\xCC\x81milie\/rails\/test_app/ (RegexpError)
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions.rb:117:in `relative_to_original_destination_root'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:87:in `destination='
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:37:in `initialize'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:15:in `new'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:15:in `empty_directory'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/railties-3.1.1/lib/rails/generators/app_base.rb:103:in `create_root'
	from (eval):1:in `create_root'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/railties-3.1.1/lib/rails/commands/application.rb:31:in `<top (required)>'
	from /Users/billgates/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /Users/billgates/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/railties-3.1.1/lib/rails/cli.rb:15:in `<top (required)>'
	from /Users/billgates/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /Users/billgates/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/gems/rails-3.1.1/bin/rails:7:in `<top (required)>'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/bin/rails:19:in `load'
	from /Users/billgates/.rvm/gems/ruby-1.9.3-head / rails3.1.1/bin/rails:19:in `<main>'
 
There is no such problem with:
- ruby 1.9.2 - ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0],
- Apple's system ruby ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

Yours


-- 
http://redmine.ruby-lang.org