本文介绍了pdf-writer无效多字节字符(US-ASCII)期望keyword_end内容=“%PDF - #{@ version} \%%ÏÓ\\\<br/>” Rails 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行的协作项目中遇到pdf-writer gem问题,我正在使用 RVM Ruby 1.9.2p180 Rails 3.1.0 位于 Ubuntu 10.10



我使用Bundler创建了一个新的 gemset 来安装所需的gem,但是当我尝试运行该应用程序时,我得到了下面的错误;

  josethernandezc @ DG965WH:〜/ Desktop / conest31 $ rails s 
/home/josethernandezc/.rvm/gems/ ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:在'require'中:/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180 (US-ASCII)(SyntaxError)
/home/josethernandezc/.rvm/gems/ruby- 1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:无效多字节字符(US-ASCII)
/home/josethernandezc/.rvm/gems/ ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:语法错误,unexpec ted $ end,期待keyword_end
content =%PDF - #{@ version} \%%ÏÓ\\\

^
from /home/josethernandezc/.rvm/gems/ ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:在`block in require'
from /home/josethernandezc/.rvm/gems/ruby -1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:在`block in load_dependency'
from /home/josethernandezc/.rvm/gems/ruby- 1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:在`new_constants_in'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2 -p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:在`load_dependency'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@ conest31 / gems / activesupport-3.1.0 / lib / active_support / dependencies.rb:240:在'require'
from /home/josethernandezc/Desktop/conest31/config/application.rb:58:in`<顶部(必填)> ;'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in`require'$ b / b from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in`block in< top(必需)>'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in`点击'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in`< top (需要)>'script / rails中的
:6中的'require'
中的脚本/ rails:6:< main>'

问题出在 pdf-writer-1.1.8 / lib / pdf / writer.rb:712 content =%PDF - #{@ version} \%%ÏÓ\\\



会很棒,我试图谷歌的错误,但我还没有找到任何具体的PDF编写器....

解决方案

pdf-writer 与Ruby 1.9不兼容。有一个分支是:



将Gemfile中的 pdf-writer 行更改为:

  gem'pdf-writer',:git => 'git://github.com/metaskills/pdf-writer.git'


I have a problem with the pdf-writer gem on a collaborative project I'm trying to run, I'm using RVM, Ruby 1.9.2p180, Rails 3.1.0 on Ubuntu 10.10.

I created a new gemset to install the required gems with Bundler, but when I try to run the app I get the fallowing error;

josethernandezc@DG965WH:~/Desktop/conest31$ rails s
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII) (SyntaxError)
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII)
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: syntax error, unexpected $end, expecting keyword_end
content = "%PDF-#{@version}\n%âãÏÓ\n"
                                ^
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /home/josethernandezc/Desktop/conest31/config/application.rb:58:in `<top (required)>'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in `block in <top (required)>'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

The problem is in the pdf-writer-1.1.8/lib/pdf/writer.rb:712, especifically; content = "%PDF-#{@version}\n%âãÏÓ\n"

Any suggestions would be great, I tried to Google the error but I have not found anything specific to pdf-writer....

解决方案

pdf-writer is not compatible with Ruby 1.9. There is a fork which is: https://github.com/metaskills/pdf-writer

Change the pdf-writer line in your Gemfile for:

gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'

这篇关于pdf-writer无效多字节字符(US-ASCII)期望keyword_end内容=“%PDF - #{@ version} \%%ÏÓ\\\<br/>” Rails 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:56