On Mac OS X 10.6.8 with Ruby 1.9.3, using a spec file name containing a non-ASCII character (an em-dash) I''m getting the error "in ''=~'': invalid byte sequence in US-ASCII (ArgumentError)" on this line self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/} in the method "first_caller_from_outside_rspec" of the rspec-core-2.7.0/lib/rspec/core/metadata.rb file. Is there a simple fix, perhaps something other than "en_US.UTF-8" as the setting for the LANG environment variable, that wouldn''t cause other issues? -- Bruce Hobbs, CCP, CDP Engineered Software Office: 626-570-8028 Partner 856 N Monterey St Cell: 626-278-0273 Alhambra, CA 91801-1574 FAX: 208-474-0732
Hello, have you tried to put # encoding: utf-8 in the begin of file? Maybe the answers in http://stackoverflow.com/questions/7699018/in-ruby-on-rails-are-encoding-utf-8-and-config-encoding-utf-8-differe can explain better this issue Regards On Wed, Nov 9, 2011 at 1:23 PM, Bruce Hobbs <brucehobbs at engineeredsw.com>wrote:> On Mac OS X 10.6.8 with Ruby 1.9.3, using a spec file name containing a > non-ASCII character (an em-dash) I''m getting the error > > "in ''=~'': invalid byte sequence in US-ASCII (ArgumentError)" > > on this line > > self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/} > > in the method "first_caller_from_outside_rspec" of the > rspec-core-2.7.0/lib/rspec/core/metadata.rb file. > > Is there a simple fix, perhaps something other than "en_US.UTF-8" as the > setting for the LANG environment variable, that wouldn''t cause other > issues? > -- > Bruce Hobbs, CCP, CDP Engineered Software Office: 626-570-8028 > Partner 856 N Monterey St Cell: 626-278-0273 > Alhambra, CA 91801-1574 FAX: 208-474-0732 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20111109/fcac1c81/attachment.html>
At 19:29:22 -0200 on Wed, 9 Nov 2011, Samir Braga <samirbraga at gmail.com> wrote:>Hello, have you tried to put > ># encoding: utf-8 > >in the begin of file? >I did try that, but it seems to make sense that it didn''t work since, AFAICT, the problem is with the FQN of the spec file.>Maybe the answers in >http://stackoverflow.com/questions/7699018/in-ruby-on-rails-are-encoding-utf-8-and-config-encoding-utf-8-differe >can explain better this issue >If I''m understanding that discussion correctly it also addresses file contents not file names. -- Bruce Hobbs, CCP, CDP Engineered Software Office: 626-570-8028 Partner 856 N Monterey St Cell: 626-278-0273 Alhambra, CA 91801-1574 FAX: 208-474-0732