karnov / htmltoword

Ruby html to word gem
MIT License
179 stars 71 forks source link

"[Invalid encoding]" #39

Open janpadrta opened 8 years ago

janpadrta commented 8 years ago

When I try to Htmltoword::Document.create(content, word_template, extras), I got result "[Invalid encoding]". I went through generate method and I have found out that 4 parts of template (docProps/thumbnail.jpeg, word/fontTable.xml, word/numbering.xml, word/theme/theme1.xml) have encoding ASCII-8BIT and the rest have UTF-8.

I don't know, if this is the problem, because I tried .force_encoding('utf-8') on every part when generating with no result.

anitsirc commented 8 years ago

Hi, @janpadrta Maybe it has something to do, Word is really strict on that. All the xml files used come from the word template - that is an actual word file that is decompressed modified and compressed again - so I wouldn't mess up with the encoding. What are you trying to force_encode?