Wicked_pdf: Encoding issues

Created on 20 Apr 2011  路  8Comments  路  Source: mileszs/wicked_pdf

Hi,

I've been able to generate PDF documents under Ubuntu and Rails 3.

The problem I'm facing is with latin characters like (谩, 茅, 铆, 贸, 煤). They are not being rendered well in the PDF document. Instaed i'm getting the following.

贸 => 脙3
茅 => 脙漏

I've tried adding :encoding => "utf8" but nothing happened.

Any workaround?

Most helpful comment

I've added a note to the README in this commit:
https://github.com/mileszs/wicked_pdf/commit/9684b092e22dc0a9ea7a2b7e707b60184f2c5715

Thanks for all your participation!

All 8 comments

Can you try putting this line:

  # encoding: utf-8

as the first line of your controller (possibly the Model as well) that is rendering the PDF?

here's an example repository of a project that does just that (and has some special chars on the pdf)
https://github.com/DevL/shownotes/tree/master/SHRUG_2011-04-13_PDF/wicked

I think that's all you should need to do. Please report back and let me know how that went.

i had the same issue, putting encoding: utf-8 didn't solve the problem

Are you using the latest version of this plugin from Github? I only recently made the streams work in binary mode in this commit:
https://github.com/mileszs/wicked_pdf/commit/788ad4ed8b498099ea65976f7b9f08d701086d03

I had the same issue.

To solve it, i add at the beggining of my view this line :

Now it works fine and I add nothing in my controller (no #encoding: utf-8 or :encoding => "utf8")

@luckynumberslevin: Awesome! That's exactly the type of thing that keeps me up at night. I think I'll throw something about that in the README.

Got it! thanks a lot guys. I'm using the lib in a project in a project & it works well, maybe i'll switch to the gem to simplify management with bundler.

Thanks luckynumberslevin ! Makes the job.

I've added a note to the README in this commit:
https://github.com/mileszs/wicked_pdf/commit/9684b092e22dc0a9ea7a2b7e707b60184f2c5715

Thanks for all your participation!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

supriyas12 picture supriyas12  路  4Comments

lisamburns picture lisamburns  路  3Comments

thomasbalsloev picture thomasbalsloev  路  3Comments

kavitakanojiya picture kavitakanojiya  路  5Comments

douglasep picture douglasep  路  4Comments