Closed tenzan closed 10 years ago
Same problem for all languages with no letter (chinese, korea, whatever else).
You can skirt this error with : "".force_encoding('ISO-8859-1') when saving your string.
Rendering will sucks if your font is not managing these symbols.
Another error will pop if you are using a font that can manage symbols (ex : BabelStoneHan.ttf) : can't convert String into Hash
What I'll say is probably stupid but, imo it comes from the fact text-methods are trying to convert everything in iso-8859-1 instead of keeping infos in their encoding.
Thanks for heads up.
require 'rghost' include RGhost
doc = Document.new :paper => :A4, :encoding => 'utf-8'
doc.text_in :x => 5, :y=> 28, :write => "東京"
doc.render :pdf, :filename => "file.pdf"
When I ran the code above I got errors:
/Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ruby_ghost_config.rb:78:in'
encode': U+6771 from UTF-8 to ISO-8859-1 (Encoding::UndefinedConversionError) from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ruby_ghost_config.rb:78:in
block in module:Config' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ruby_to_ps.rb:16:incall' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ruby_to_ps.rb:16:in
pack_string' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ruby_to_ps.rb:62:instring_eval' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/text_in.rb:40:in
ps' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ps_object.rb:41:inset' from /Users/askar/.rvm/gems/ruby-2.0.0-p195/gems/rghost-0.9.3/lib/rghost/ps_facade.rb:141:in
text_in' from rghost.rb:6:in `