trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 200 forks source link

invalid byte sequence in UTF-8 (ArgumentError) #56

Open MP3en opened 10 years ago

MP3en commented 10 years ago

Hallo, since i installed osx mavericks i get the following error message: Maybe sombody know what to do.

/Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:216:in `scan': invalid byte sequence in UTF-8 (ArgumentError)
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:216:in `process_file'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:202:in `block in process_files'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:198:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:198:in `process_files'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:191:in `block in process_dir'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:184:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:184:in `process_dir'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:127:in `build_docs'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/lib/hologram.rb:92:in `init'
    from /Library/Ruby/Gems/2.0.0/gems/hologram-0.6.0/bin/hologram:5:in `<top (required)>'
    from /usr/bin/hologram:23:in `load'
    from /usr/bin/hologram:23:in `<main>'
aflanagan commented 10 years ago

Hmmm... I have not seen that (I'm also running OSX Mavericks).

What are the exact OSX and Ruby versions you are running? My setup is:

OS X 10.9 (13A603) ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

mhauken commented 10 years ago

I'm getting the same error.

/Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:90:in `scan': invalid byte sequence in UTF-8 (ArgumentError)
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:90:in `process_file'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:77:in `block in process_files'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:71:in `each'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:71:in `process_files'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:66:in `block in process_dir'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:59:in `each'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:59:in `process_dir'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:24:in `block in parse'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:23:in `each'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_parser.rb:23:in `parse'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_builder.rb:116:in `build_docs'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/doc_builder.rb:65:in `build'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/cli.rb:38:in `build'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/lib/hologram/cli.rb:30:in `run'
from /Users/admin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/hologram-1.2.0/bin/hologram:6:in `<top (required)>'
from /Users/admin/.rbenv/versions/2.0.0-p247/bin/hologram:23:in `load'
from /Users/admin/.rbenv/versions/2.0.0-p247/bin/hologram:23:in `<main>'

It works with the hologram example project, but not in my own project. I've tried with both ruby 2.0.0-p247 and 2.0.0-p353 First I thought it was because I use æ,ø and å in my documentation, but that works fine in the example project.. Any ideas?

oscherler commented 9 years ago

Do you have ._something files in your CSS path by any chance?

mhauken commented 9 years ago

@oscherler I have a lot of _something.scss files if that's what you are meaning. Not a lot of dot-files though.. and not as a combination ( "dot" + "underscore" before filename)

jdcantrell commented 9 years ago

Seems like it's going to be something along these lines: http://stackoverflow.com/questions/9607554/ruby-invalid-byte-sequence-in-utf-8

I'll have to take a look and see if there is something specific we're doing.

jtwee commented 9 years ago

Just came across this problem and our issue was with empty files in the source path.

jdcantrell commented 9 years ago

Thanks for adding more details, we'll look into this.

soulpimp commented 9 years ago

Is there any word on if this has been fixed or if there is a workaround for this issue? running: ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

jdcantrell commented 9 years ago

Can you share a source file that causes this?

pflannery commented 9 years ago

I had the same issue and found that comments with text like Léonie seem to cause this issue

The below example was causing the error but without Léonie it worked.

/* Replace the div at the head with a button element. This is based on feedback from Léonie Watson.
 * The button has all of the accessibility hooks that are used by screen readers and etc.
 * We do this in the JavaScript because if the JavaScript is not active then the button shouldn't
 * be there as there is no JS to handle the click event.
 */

Hope that helps

ajaykarwal commented 8 years ago

I had the same issue today and found it was related to Unicode characters.

I used this regex pattern [^\x00-\x7f] to find all Unicode characters in my .scss files and either changed or deleted them

Source: http://devblog.appriver.com/removing-hidden-unicode-characters-from-visual-studio/