Wrong interpretation of characters with LANG=C #183

Closed
voxik opened this Issue Feb 6, 2013 · 0 comments

Projects

None yet

2 participants

@voxik
$ curl -O https://raw.github.com/jimweirich/rake/master/TODO
$ LANG=C rdoc TODO --debug
Parsing sources...
100% [ 1/ 1]  TODO                                                              

cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png images/macFFBgHack.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/package.png images/package.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/page_green.png images/page_green.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/page_white_text.png images/page_white_text.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/page_white_width.png images/page_white_width.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/plugin.png images/plugin.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/ruby.png images/ruby.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/tag_blue.png images/tag_blue.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/tag_green.png images/tag_green.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/transparent.png images/transparent.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/wrench.png images/wrench.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/wrench_orange.png images/wrench_orange.png
cp /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/images/zoom.png images/zoom.png
Rendering the index page...
Outputting to /builddir/build/BUILD/rubygem-rake-10.0.3/doc/index.html
Generating class documentation in /builddir/build/BUILD/rubygem-rake-10.0.3/doc
Generating file documentation in /builddir/build/BUILD/rubygem-rake-10.0.3/doc
  working on TODO (/builddir/build/BUILD/rubygem-rake-10.0.3/doc/TODO.html)
  rendering /builddir/build/BUILD/rubygem-rake-10.0.3/doc/TODO.html
Outputting to /builddir/build/BUILD/rubygem-rake-10.0.3/doc/TODO.html
RDoc::Error: error generating : "\xE2" on US-ASCII (Encoding::InvalidByteSequenceError)
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/page.rhtml:29:in `write'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/page.rhtml:29:in `block in generate_page'
  /usr/share/ruby/erb.rb:849:in `eval'
  /usr/share/ruby/erb.rb:849:in `result'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:685:in `template_result'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:664:in `block in render_template'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `open'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `open'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `render_template'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:444:in `generate_page'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:384:in `block in generate_file_files'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:380:in `each'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:380:in `generate_file_files'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:224:in `generate'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:526:in `block in generate'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:521:in `chdir'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:521:in `generate'
  /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:504:in `document'
  /bin/rdoc:20:in `<main>'
error generating : "\xE2" on US-ASCII (Encoding::InvalidByteSequenceError)
/usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/page.rhtml:29:in `write'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/template/darkfish/page.rhtml:29:in `block in generate_page'
    /usr/share/ruby/erb.rb:849:in `eval'
    /usr/share/ruby/erb.rb:849:in `result'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:685:in `template_result'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:664:in `block in render_template'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `open'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `open'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:659:in `render_template'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:444:in `generate_page'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:384:in `block in generate_file_files'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:380:in `each'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:380:in `generate_file_files'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/generator/darkfish.rb:224:in `generate'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:526:in `block in generate'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:521:in `chdir'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:521:in `generate'
    /usr/share/gems/gems/rdoc-4.0.0.preview3.1/lib/rdoc/rdoc.rb:504:in `document'
    /bin/rdoc:20:in `<main>'

If you remove the equal sign on the beginning or one of the two dashes in the middle, it works. It also works just fine with $ LANG=en_US.utf8 rdoc TODO --debug

@drbrain drbrain added a commit that closed this issue Feb 8, 2013
@drbrain drbrain Set template encoding correctly
When partials for templates were created the encoding of the output was
not properly set.  This would lead to encoding errors when invalid
characters where generated while writing to the main page.

Now the template source is transcoded to the output encoding which
allows the template result encoding to be correct.

This issue resisted efforts to write a proper test-case.

Fixes #183
e12ca93
@drbrain drbrain closed this in e12ca93 Feb 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment