Project

General

Profile

Actions

Defect #6505

closed

PDF export broken with Japanese (Gannt and Issue Tracking)

Added by Leo Hourvitz about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
PDF export
Target version:
-
Start date:
2010-09-27
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

When exporting Gannts or Issue Lists to PDF, the Japanese-language text is garbled (the English-language text comes out fine). A sample image is attached.

I suspect this will be true of any PDF export, but those are the two exports I've tried this with.

Note that unlike the report regarding Hebrew, this is not true of CSV export for Issue Lists; those come out fine via the UTF-8 encoding.

  • CentOS 5.3
  • MySQL 5.0.77 (yes my charset is UTF-8)
  • ruby 1.8.7
  • Rails 1.2.6 (I think, I'm using the one that was packaged with redmine 1.0.1)

I'm in Tokyo so this would seem to rule out decent printing from Redmine. Because CSV export works, there's always that workaround for Issue Lists.

I've read about the GANTT rewrite, but the fact this is in issue list export as well suggests it's something more generic. I listed the two related reports, but I couldn't see anything where this was resolved.


Files

JapaneseBecomesGarbage.png (9.93 KB) JapaneseBecomesGarbage.png A sample of the mangled output Leo Hourvitz, 2010-09-27 05:48
japanese.rb.patch (2.82 KB) japanese.rb.patch Jun NAITOH, 2011-03-21 04:12
korean.rb.patch (3.29 KB) korean.rb.patch Jun NAITOH, 2011-03-21 04:12
chinese.rb.patch (3.14 KB) chinese.rb.patch Jun NAITOH, 2011-03-21 04:12
pdf.rb_utf8.patch (9.79 KB) pdf.rb_utf8.patch Jun NAITOH, 2011-03-22 22:24
gantt.rb_utf8.patch (5.14 KB) gantt.rb_utf8.patch Jun NAITOH, 2011-03-22 22:24
korean.rb_utf8.patch (1.86 KB) korean.rb_utf8.patch Jun NAITOH, 2011-03-22 22:24
japanese.rb_utf8.patch (1.05 KB) japanese.rb_utf8.patch Jun NAITOH, 2011-03-22 22:24
chinese.rb_utf8.patch (1.62 KB) chinese.rb_utf8.patch Jun NAITOH, 2011-03-22 22:24

Related issues

Related to Redmine - Defect #5884: PDF export doesn't work for HebrewClosed2010-07-15

Actions
Related to Redmine - Feature #4699: Export PDF in Chinese and Japanese language is get well in redmine 0.8.7Closed2010-01-31

Actions
Related to Redmine - Defect #7794: Internal server error on formatting an issue as a PDF in JapaneseClosedToshi MARUYAMA2011-03-06

Actions
Related to Redmine - Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ?ClosedToshi MARUYAMA2010-02-10

Actions
Is duplicate of Redmine - Defect #61: Broken character encoding in pdf exportClosedToshi MARUYAMA

Actions
Actions #1

Updated by Leo Hourvitz about 14 years ago

Hmm, I just I can't add related issues if I'm not a Developer?

Anyway, the two related (but not identical) issues I see are:

  • #5884 Hebrew language export problem (but he couldn't export CSVs either?)
  • #4699 Chinese/Japanese export described as a feature? (I didn't understand the report clearly)
Actions #2

Updated by Igor Velkov about 14 years ago

Same for russian: I try to save as pdf an issue with comments, and got pdf with russian garbled text.

Actions #3

Updated by Toshi MARUYAMA about 14 years ago

In Japanese, Issue Tracking works fine.
Please see http://www.redmine.org/boards/2/topics/11734 .

But Gantt is broken at 1.0.2.

Actions #4

Updated by John Yani almost 14 years ago

PDF enconding is a known bug of Redmine. See issue #61.

Actions #5

Updated by Toshi MARUYAMA almost 14 years ago

#61 is UTF-8 and font problem.
"general_pdf_encoding" at source:/tags/1.0.4/config/locales/ja.yml#L159 is "CP932".
So, PDF for issue list has no problem as long as user uses only Japanese character and user locale is "ja".

But, Gannt is broken at 1.0.2.
This is related with #6348.

Actions #6

Updated by Jun NAITOH over 13 years ago

This patch fixed the PDF export broken problem with Japanese/Chinese/Korean.
This is Rfpdf plugin's problem. Rfpdf plugin don't expect to input of UTF-8 character set....

Flow of PDF export broken problem (issue_to_pdf) in Japanese case.

  1. lib/redmine/export/pdf.rb : pdf.MultiCell (use UTF-8 character set)
  2. vendor/plugins/rfpdf/lib/rfpdf/japanese.rb : def MultiCell (expect SJIS character set input)
  3. vendor/plugins/rfpdf/lib/rfpdf/japanese.rb : Cell (expect SJIS character set output)
  4. lib/redmine/export/pdf.rb : def Cell (expect UTF-8 character set input)

MultiCell break UTF-8 3byte character.(Because, SJIS is 2byte character.)

Changed by this patch.

  1. lib/redmine/export/pdf.rb : pdf.MultiCell (use UTF-8 character set)
  2. vendor/plugins/rfpdf/lib/rfpdf/japanese.rb : def MultiCell (expect UTF-8 character set input)
  3. vendor/plugins/rfpdf/lib/rfpdf/japanese.rb : Cell (expect UTF-8 character set output)
  4. lib/redmine/export/pdf.rb : def Cell (expect UTF-8 character set input)

As for Chinese and Korean, it is similar.

My environment is as follows.

  • CentOS 5.5(x86)
  • Redmine 1.1.2
  • ruby 1.8.7
  • Rubygems 1.3.5
  • sqlite 3.3.6
Actions #7

Updated by Toshi MARUYAMA over 13 years ago

  • Category changed from Issues to PDF export
  • Status changed from New to 7
  • Assignee set to Toshi MARUYAMA
Actions #8

Updated by Toshi MARUYAMA over 13 years ago

  • Assignee deleted (Toshi MARUYAMA)

It seems an effect of note 6 patches is big.
I don't know about PDF, I remove assignee.

Actions #9

Updated by Jun NAITOH over 13 years ago

Sorry, a effect of note 6 patches is big... I'm think so, too.
I want to reduce the patches's effect. so, I rewrote this patch.

This new patch don't change the rpdf plugin interface spec.

This is related to #1170 patch.

Changed by this rewritten patch.

  • UTF-8 input function added.
    • lib/redmine/export/pdf.rb : def UTF8MultiCell (expect UTF-8 character set input, and use iconv)
    • lib/redmine/export/pdf.rb : def UTF8Cell (expect UTF-8 character set input, and use iconv)
  • some minor fix.
    • tab character clash problem fix (japanese.rb only)
    • don't work 'explicit line break' problem fix (korean.rb only)
    • etc
Actions #10

Updated by Toshi MARUYAMA over 13 years ago

Jun, thank you for your reply.
Are you Japanese? Do you live in USA? Patch timezone is "-0400".
I am Japanese and I live in Japan.

CJK PDF is very difficult.
I want to close this issue with duplicate of #61.
I can see issue watchers of this site.
Many users watch #61.

Actions #11

Updated by Jun NAITOH over 13 years ago

I'm Japanese and live in Japan. Patch timezone is mistake, sorry.
I understand #61 issue, now.... so, it's very long....

I tested with English/Japanese/Chinese/Korean.
Because, I thought that the PDF export broken problem is CJK only.

But, #61 issue isn't CJK only.

OK, I will try to close #6505 and #61.

Actions #12

Updated by Toshi MARUYAMA over 13 years ago

  • Status changed from 7 to Closed
  • Resolution set to Duplicate

Thank you posting new patch to #61.

Actions

Also available in: Atom PDF