pdf-writer无效多字节字符(US-ASCII)期望keyword_end内容=“%PDF - #{@ version} \ n%ÏÏ\ n”Rails 3

时间:2012-01-27 15:25:32

标签: ruby-on-rails-3 gem ascii pdf-writer

我正在尝试运行的协作项目上的pdf-writer gem存在问题,我在{{1}上使用RVMRuby 1.9.2p180Rails 3.1.0 }。

我创建了一个新的Ubuntu 10.10来安装Bundler所需的宝石,但是当我尝试运行应用程序时,我得到了一个错误的错误;

gemset

问题出在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>' ,特别是; pdf-writer-1.1.8/lib/pdf/writer.rb:712

任何建议都会很棒,我试图谷歌错误但我没有找到任何特定于pdf-writer ....

3 个答案:

答案 0 :(得分:3)

pdf-writer与Ruby 1.9不兼容。有一个叉子:https://github.com/metaskills/pdf-writer

更改Gemfile中的pdf-writer行:

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

答案 1 :(得分:1)

我刚将pdf-writer移植到Ruby 2.0。将请求发送到metaskills(在前面的答案中引用)。

如果您在此期间需要Ruby 2.0,请在此处找到分叉代码:

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

答案 2 :(得分:1)

pdf-writer的分支也适用于Ruby 2.1,谢谢。

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