Project

General

Profile

Actions

Defect #8569

closed

JRuby: PDF export error with TypeError

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

Status:
Closed
Priority:
Normal
Assignee:
Toshi MARUYAMA
Category:
PDF export
Target version:
Start date:
2011-06-09
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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'
Actions

Also available in: Atom PDF