Hi, Does the pdf/writer support unicode? When i render a pdf with swedish or german names, it displays some garbled text. Is this a font issue? Thanks, /franee -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/8/06, Francis Sinson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Does the pdf/writer support unicode? When i render a pdf with swedish or > german names, it displays some garbled text. Is this a font issue?PDF::Writer''s documentation is very clear about this: PDF does not support UTF-8, and that''s probably what you''re trying to use. Use substitution character maps instead (the example code in _The Ruby Way_ 2nd Edition talks about how to use this). UTF-16 support will be added to PDF::Writer at some point in the future. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> On 12/8/06, Francis Sinson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> Does the pdf/writer support unicode? When i render a pdf with swedish or >> german names, it displays some garbled text. Is this a font issue? > > PDF::Writer''s documentation is very clear about this: PDF does not > support UTF-8, and that''s probably what you''re trying to use. Use > substitution character maps instead (the example code in _The Ruby > Way_ 2nd Edition talks about how to use this). UTF-16 support will be > added to PDF::Writer at some point in the future. > > -austin > -- > Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.orgOk i''ll check on that. Thanks for the fast reply:) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Francis Sinson wrote:> Austin Ziegler wrote: >> On 12/8/06, Francis Sinson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>> Does the pdf/writer support unicode? When i render a pdf with swedish or >>> german names, it displays some garbled text. Is this a font issue? >> >> PDF::Writer''s documentation is very clear about this: PDF does not >> support UTF-8, and that''s probably what you''re trying to use. Use >> substitution character maps instead (the example code in _The Ruby >> Way_ 2nd Edition talks about how to use this). UTF-16 support will be >> added to PDF::Writer at some point in the future. >> >> -austin >> -- >> Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ >> * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ >> * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org > > Ok i''ll check on that. Thanks for the fast reply:)when i add any of these strings direct to pdf, it displays perfectly well. "Straße", "öffnen", "Østergade 4. 1,tv" but when i pull up the same strings in the db, it gets garbled. any idea why? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/8/06, Francis Sinson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Francis Sinson wrote: > > Austin Ziegler wrote: > >> On 12/8/06, Francis Sinson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >>> Does the pdf/writer support unicode? When i render a pdf with swedish or > >>> german names, it displays some garbled text. Is this a font issue? > >> > >> PDF::Writer''s documentation is very clear about this: PDF does not > >> support UTF-8, and that''s probably what you''re trying to use. Use > >> substitution character maps instead (the example code in _The Ruby > >> Way_ 2nd Edition talks about how to use this). UTF-16 support will be > >> added to PDF::Writer at some point in the future. > >> > >> -austin > >> -- > >> Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > >> * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > >> * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org > > > > Ok i''ll check on that. Thanks for the fast reply:) > when i add any of these strings direct to pdf, it displays perfectly > well. "Straße", "öffnen", "Østergade 4. 1,tv" > > but when i pull up the same strings in the db, it gets garbled. any idea > why?That I can''t answer. If you''re using MySQL, it''s partially because MySQL is dumber than dirt 99% of the time. You need to make sure you''re encoding things properly and you may need to use iconv to switch encodings around, or build your substitution character maps to reflect what''s actually stored in your database (which is easier than it sounds). I''ll be getting back to PDF::Writer development in the new year and one of the things I want to allow for is multiple instances of the same font with different character maps. That will go a long way toward delaying the need for UTF-16 support (because that''s very *hard* to do). -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Austin, Austin Ziegler wrote:> I''ll be getting back to PDF::Writer development > in the new year and one of the things I want to ...I''ve been using PDF::Writer, very happily, to produce PDFs. Now I''ve been given a requirement to include the XML file that the PDF documents are based on into the PDF file itself. Any chance you''re interested in PDF::Writer having that capability? I''d be interested in helping with / doing the work. Thanks for all the work you''ve already done. It''s a great tool! Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> when i add any of these strings direct to pdf, it displays perfectly > well. "Straße", "öffnen", "Østergade 4. 1,tv" > > but when i pull up the same strings in the db, it gets garbled. any idea > why?Make sure everything is in UTF-8. Here are some places to check: ---database.yml--- development: adapter: mysql database: 123 username: 123 password: 123 host: localhost encoding: utf8 ---class ApplicationController--- def set_charset @headers["Content-Type"] ||= "text/html; charset=UTF-8" end ---your database tables--- make sure they are set to UTF-8 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/10/06, Taylor Strait <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > when i add any of these strings direct to pdf, it displays perfectly > > well. "Straße", "öffnen", "Østergade 4. 1,tv" > > > > but when i pull up the same strings in the db, it gets garbled. any idea > > why? > Make sure everything is in UTF-8. Here are some places to check:Except that this is probably *exactly* why the OP is having problems with PDF::Writer and the strings being garbled. PDF::Writer does not AND WILL NEVER support UTF-8 (it will support UTF-16). You will need to use iconv to convert from UTF-8 to a suitable single-byte encoding in order to print in PDF::Writer. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> On 12/10/06, Taylor Strait <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> > when i add any of these strings direct to pdf, it displays perfectly >> > well. "Stra�e", "�ffnen", "�stergade 4. 1,tv" >> > >> > but when i pull up the same strings in the db, it gets garbled. any idea >> > why? >> Make sure everything is in UTF-8. Here are some places to check: > > Except that this is probably *exactly* why the OP is having problems > with PDF::Writer and the strings being garbled. PDF::Writer does not > AND WILL NEVER support UTF-8 (it will support UTF-16). You will need > to use iconv to convert from UTF-8 to a suitable single-byte encoding > in order to print in PDF::Writer. > > -austin > -- > Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.orgyeah my db is set to utf-8. That is probably the reason why it gets garbled on pdf/writer. I''ll check out iconv and will let you know of the results. Thanks for all the inputs guys:) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Finally fixed the problem. I used this: require ''iconv'' ic_ignore = Iconv.new(''ISO-8859-15//IGNORE//TRANSLIT'', ''UTF-8'') ic_ignore.iconv(''string from db with utf-8 encoding'') Thanks for all the help guys:) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> with PDF::Writer and the strings being garbled. PDF::Writer does not > AND WILL NEVER support UTF-8 (it will support UTF-16). You will needPardon me if this is common knowledge, but is there any particular reason to dismiss UTF-8? Because from what I can tell, pretty much everything (at least in Europe) seems to be moving towards UTF-8, a trend which imho is already long overdue. And how is UTF-16 any better than UTF-8? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/11/06, mati <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Austin Ziegler wrote: > > with PDF::Writer and the strings being garbled. PDF::Writer does not > > AND WILL NEVER support UTF-8 (it will support UTF-16). You will need > Pardon me if this is common knowledge, but is there any particular > reason to dismiss UTF-8? Because from what I can tell, pretty much > everything (at least in Europe) seems to be moving towards UTF-8, a > trend which imho is already long overdue. And how is UTF-16 any better > than UTF-8?It''s actually supported by the underlying specification. UTF-8 isn''t. I''m not going to convert your data for you. I might do so in Ruby 1.9.1 when I can depend on the encoding attached to the strings, but not before. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---