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

utf8 encoding problem #51

Closed ollym closed 10 years ago

ollym commented 10 years ago

I'm seeing a lot of other reported problems with utf8 encoding. I've given what I think is the correct way of putting this together but I'm still having issues:

class TestDocument < RGhost::Document

  def initialize
    RGhost::Config::GS[:font_encoding] = 'UTF-8'
    RGhost::Config::GS[:charset_convert] = -> (text) {
      text.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
    }

    super font_encoding: 'UTF-8'
    show '東'
  end
end

Output of is:

screen shot 2014-03-26 at 09 37 04

When I'd expect it to be '東'