Defect #8569

JRuby: PDF export error with TypeError

Added by Toshi MARUYAMA over 6 years ago. Updated over 6 years ago.

Status:ClosedStart date:2011-06-09
Priority:NormalDue date:
Assignee:Toshi MARUYAMA% Done:

0%

Category:PDF export
Target version:1.2.1
Resolution:Fixed Affected version:1.2.0

Description

TypeError in IssuesController#show

can't convert nil into String

/REDMINE-2/hg-git/redmine/lib/redmine/export/pdf.rb:417:in `rdm_pdf_iconv'
/REDMINE-2/hg-git/redmine/lib/redmine/export/pdf.rb:101:in `fix_text_encoding'
/REDMINE-2/hg-git/redmine/lib/redmine/export/pdf.rb:109:in `RDMMultiCell'
/REDMINE-2/hg-git/redmine/lib/redmine/export/pdf.rb:276:in `issue_to_pdf'
/REDMINE-2/hg-git/redmine/app/controllers/issues_controller.rb:124:in `show'
/REDMINE-2/hg-git/redmine/app/controllers/issues_controller.rb:120:in `show'

The reason

"狀態" can not be converted to Japanese SJIS.
source:trunk/test/unit/lib/redmine/export/pdf_test.rb@6013#L43

$ python
>>> s = "\xe7\x8b\x80\xe6\x85\x8b" 
>>> print s
狀態
>>> s.decode("UTF-8").encode("SJIS")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'shift_jis' codec can't encode character u'\u72c0' in position 0: illegal multibyte sequence
>>> s.decode("UTF-8").encode("BIG5")
'\xaa\xac\xbaA'
>>> s.decode("UTF-8")
u'\u72c0\u614b'

Associated revisions

Revision 6024
Added by Toshi MARUYAMA over 6 years ago

PDF: replace all non ASCII characters to '?' if Iconv error raise in JRuby (#8569, #61).

History

#1 Updated by Toshi MARUYAMA over 6 years ago

  • Target version set to 1.2.1

#2 Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Committed in trunk and 1.2-stable,

Also available in: Atom PDF