shairontoledo / rghost

RGhost is a document creation and conversion API. It uses the Ghostscript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents. Support(PDF,PS,GIF,TIF,PNG,JPG,etc)
http://rghost.rubyforge.org
MIT License
187 stars 46 forks source link

rghost 0.9.4 ruby_to_ps.rb:5 Invalid Multibyte Char (US-ASCII) #56

Closed nightsurge closed 10 years ago

nightsurge commented 10 years ago

Hi there, just updated to 0.9.4 today and am getting an error trying to run rails server. Works fine if I revert back to 0.9.3.

SyntaxError: /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost/ruby_to_ps.rb:5: invalid multibyte char (US-ASCII) require at org/jruby/RubyKernel.java:1085 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:1 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 load_dependency at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 require at org/jruby/RubyKernel.java:1085 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost/callback.rb:2 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:1 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 load_dependency at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236 require at org/jruby/RubyKernel.java:1085 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost/dynamic_document_callback.rb:1 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:1 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 each at org/jruby/RubyArray.java:1613 load_dependency at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236 require at org/jruby/RubyKernel.java:1085 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:5 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:1 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:1 require at org/jruby/RubyKernel.java:1085 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 each at org/jruby/RubyArray.java:1613 load_dependency at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236 each at org/jruby/RubyArray.java:1613 require at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251 (root) at /Users/person/.rvm/gems/jruby-1.7.11@project/gems/rghost-0.9.4/lib/rghost.rb:12 (root) at /Users/person/.rvm/gems/jruby-1.7.11@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:1 require at org/jruby/RubyKernel.java:1085 require at /Users/person/.rvm/gems/jruby-1.7.11@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76 tap at org/jruby/RubyKernel.java:1893 require at /Users/person/.rvm/gems/jruby-1.7.11@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72 require at org/jruby/RubyKernel.java:1085 require at /Users/person/.rvm/gems/jruby-1.7.11@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61

synoptase commented 10 years ago

Yes indeed.

It seems like this line has disappeared from the uploaded rubygem version.

Adding # encoding: utf-8 back on top fixes the issue.

shairontoledo commented 10 years ago

That's weird version 0.9.4 incorporates the utf-8 header, are you saying that you don't see it in the gem?

On Fri, May 16, 2014 at 1:47 PM, synoptase notifications@github.com wrote:

Yes indeed.

It seems like this linehttps://github.com/shairontoledo/rghost/blob/master/lib/rghost/ruby_to_ps.rb#L1has disappeared from the uploaded rubygem version.

Adding # encoding: utf-8 back on top fixes the issue.

— Reply to this email directly or view it on GitHubhttps://github.com/shairontoledo/rghost/issues/56#issuecomment-43353416 .

Shairon Toledo http://hashcode.me

synoptase commented 10 years ago

Yup.

Weird.

On Fri, May 16, 2014 at 7:31 PM, Shairon Toledo notifications@github.comwrote:

That's weird version 0.9.4 incorporates the utf-8 header, are you saying that you don't see it in the gem?

On Fri, May 16, 2014 at 1:47 PM, synoptase notifications@github.com wrote:

Yes indeed.

It seems like this line< https://github.com/shairontoledo/rghost/blob/master/lib/rghost/ruby_to_ps.rb#L1>has disappeared from the uploaded rubygem version.

Adding # encoding: utf-8 back on top fixes the issue.

— Reply to this email directly or view it on GitHub< https://github.com/shairontoledo/rghost/issues/56#issuecomment-43353416> .

Shairon Toledo http://hashcode.me

— Reply to this email directly or view it on GitHubhttps://github.com/shairontoledo/rghost/issues/56#issuecomment-43357962 .

Benjamin Grelié Co-founder www.printicapp.com http://www.facebook.com/Printic Twitter : @printicapp Instagram @printicapp

giubueno commented 10 years ago

I solve the problem editing the first line of the file adding the following code.

-- coding: utf-8 --

I saw that It was already fixed in the current code but the version was not updated. If you point direct to repository it won't happen again.

kivanio commented 10 years ago

Fala @shairontoledo Isso aconteceu com a brcobranca após subir a versão para usar a 0.9.4.

Somente no ruby 1.9

0.9.3 está ok.

https://travis-ci.org/kivanio/brcobranca/jobs/30587220

/usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/callback.rb:2:in `require': /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ruby_to_ps.rb:5: invalid multibyte char (US-ASCII) (SyntaxError)
/usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ruby_to_ps.rb:5: invalid multibyte char (US-ASCII)
/usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ruby_to_ps.rb:5: syntax error, unexpected $end, expecting tASSOC
    '¡' => 0xA1, '¢' => 0xA2, '£'...
       ^
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/callback.rb:2:in`'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/dynamic_document_callback.rb:1:in `require'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/dynamic_document_callback.rb:1:in`'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:5:in `require'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:5:in`block in '
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:1:in `each'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ps_facade.rb:1:in`'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost.rb:12:in `require'
    from /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost.rb:12:in`'
    from /Users/kivanio/Sites/kivanio/brcobranca/spec/spec_helper.rb:14:in `require'
    from /Users/kivanio/Sites/kivanio/brcobranca/spec/spec_helper.rb:14:in`'
            
shairontoledo commented 10 years ago

@kivanio confirma pra mim por favor se tem header de utf no seu arquivo /usr/local/opt/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rghost-0.9.4/lib/rghost/ruby_to_ps.rb

kivanio commented 10 years ago

Sim em todos.

Alguns exemplos: https://github.com/kivanio/brcobranca/blob/master/spec/spec_helper.rb https://github.com/kivanio/brcobranca/blob/master/lib/brcobranca/boleto/template/rghost.rb https://github.com/kivanio/brcobranca/blob/master/lib/brcobranca/boleto/template/rghost_carne.rb

shairontoledo commented 10 years ago

Eu digo na gem que foi instalada, o arquivo ruby_to_ps.rb

kivanio commented 10 years ago

Aparentemente não:

kivanio:rghost/ (master) $ pwd                                                                                                                   [14:37:44]
/usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rghost-0.9.4/lib/rghost
kivanio:rghost/ (master) $ cat ruby_to_ps.rb                                                                                                     [14:37:31]
#Converts Ruby types to Postscript types
module RGhost::RubyToPs
  UTF8_ENCODINGS = {
shairontoledo commented 10 years ago

@kivanio Estranho isso... acho que eu tinha feito alguma caca, gerei a 0.9.5 com o fix, http://rubygems.org/gems/rghost instala ai e me diz o que rola

kivanio commented 10 years ago

aooo Goiás!

Parece que foi!

Só aguardar a confirmação do build: https://travis-ci.org/kivanio/brcobranca/builds/31071357

kivanio commented 10 years ago

Tudo green goiano!

Pode fechar a bagaça.

shairontoledo commented 10 years ago

@synoptase @nightsurge new gem version rghost-0.9.5 fixed this issue.