CoffeeTags icon indicating copy to clipboard operation
CoffeeTags copied to clipboard

invalid byte sequence in US-ASCII

Open codeout opened this issue 11 years ago • 3 comments
trafficstars

coffeetags -R -f tags fails with an error "invalid byte sequence in US-ASCII" in my osx 10.9.5.

Users/codeout/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CoffeeTags-0.5.0/lib/CoffeeTags/parser.rb:44:in `=~': invalid byte sequence in US-ASCII (ArgumentError)

(I've tried ruby 1.9.3-p545, 2.0.0-p481 and 2.1.2)

Can we suppose that *.coffee are in US-ASCII while creating tags? I'm not familiar with tags specs really but I guess keywords of CoffeeScript should be US-ASCII.

Some of specs also failed with the same error as below:

  1) Coffeetags::Utils Complete output appends tags for given file
     Failure/Error: Coffeetags::Utils.run({ :output => 'test.out', :files => ['spec/fixtures/campfire.coffee'], :append => true })
     ArgumentError:
       invalid byte sequence in US-ASCII
     # ./lib/CoffeeTags.rb:143:in `block in setup_tag_lines'
     # ./lib/CoffeeTags.rb:143:in `reject'
     # ./lib/CoffeeTags.rb:143:in `setup_tag_lines'
     # ./lib/CoffeeTags.rb:100:in `run'
     # ./spec/coffeetags_spec.rb:142:in `block (3 levels) in <top (required)>'

codeout avatar Sep 25 '14 17:09 codeout

Hi! - it might be more complicated than that.

As long as your file's encoding is US-ASCII and you don't use non-ascii characters in its contents it should be fine. Javascript (and thus CoffeeScript) supports non-ascii characters in variable names and such so that shouldn't matter. Now - weather CoffeeTag's regexes support that it's a bit different matter.

I see that you're using rbenv. Could you try using CoffeeTags with OSX's system ruby? On my machine, also 10.9) it's 2.0.0p451 so it should be ok.

If that works then it might be an issue with how your rbenv-based rubies are compiled. If it also fails under system ruby I'll keep digging.

lukaszkorecki avatar Sep 25 '14 18:09 lukaszkorecki

Hi, I didn't notice that Javascript accepts non-ascii characters for variable and function names.

So, could you try this non-ascii file which hubot requires?

In my environment, osx built-in ruby (2.0.0p481) fails to parse. ruby 2.1.2 with rbenv in debian 7 too.

codeout avatar Sep 26 '14 06:09 codeout

Thanks for the example file - much appreciated.

I will have look, possibly this weekend.

lukaszkorecki avatar Sep 26 '14 09:09 lukaszkorecki