lsegal/yard — Issue #493: incompatible character encodings: ASCII-8BIT and UTF-8 even with # encoding: utf-8
Author: tom-kuca
Created: 2012-02-24 15:04:10+00:00
State: open

Following examples fails with `incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)` even though the encoding is defined and the file is UTF-8 encoding.

```ruby
# encoding: utf-8

class Article

def run
"ř
ř"
end

end
```

The line break in the middle of string is important, everything is fine if
* there isn't the line break or
* there aren't any non-ASCII characters on either first or second line

Command:

yard -o doc /tmp/article.rb

Backtrace:

/home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/source_parser.rb:438:in `parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/source_parser.rb:361:in `parse_in_order'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/source_parser.rb:89:in `block in parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/logging.rb:66:in `enter_level'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/parser/source_parser.rb:88:in `parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard.rb:18:in `parse'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/cli/yardoc.rb:215:in `run'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/cli/command.rb:13:in `run'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/cli/command_parser.rb:68:in `run'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/lib/yard/cli/command_parser.rb:50:in `run'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.5/bin/yard:4:in `'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/bin/yard:19:in `load'
from /home/tomas/.rvm/gems/ruby-1.9.3-p0/bin/yard:19:in `

'

* Ruby 1.9.3
* Yard 0.7.5