PDF编写器无效的多字节字符(US-ASCII)期待关键字_end内容="%pdf - #{@ version} \ n%Âäó\ n"rails 3[英] pdf-writer invalid multibyte char (US-ASCII) expecting keyword_end content = "%PDF-#{@version}\n%âãÏÓ\n" Rails 3

本文是小编为大家收集整理的关于PDF编写器无效的多字节字符(US-ASCII)期待关键字_end内容="%pdf - #{@ version} \ n%Âäó\ n"rails 3的处理方法,想解了PDF编写器无效的多字节字符(US-ASCII)期待关键字_end内容="%pdf - #{@ version} \ n%Âäó\ n"rails 3的问题怎么解决?PDF编写器无效的多字节字符(US-ASCII)期待关键字_end内容="%pdf - #{@ version} \ n%Âäó\ n"rails 3问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我在我尝试运行的协作项目上有一个问题,我正在使用RVM,Ruby 1.9.2p180,Rails 3.1.0上的Ubuntu 10.10.

我创建了一个新的gemset,用bundler安装所需的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: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,特别是; content = "%PDF-#{@version}\n%âãÏÓ\n"

任何建议都会很大,我试图谷歌这个错误,但我没有找到任何特定于pdf作家的东西....

推荐答案

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'

其他推荐答案

i刚刚将pdf编写器移植到Ruby 2.0.将请求发送到Metaskills(以前的答案中引用).

如果您在同时为Ruby 2.0需要它,请在此处找到叉子代码:

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

其他推荐答案

PDF编写器的叉子也在Ruby 2.1上工作,谢谢.

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

本文地址:https://www.itbaoku.cn/post/786780.html