Defect #61
closedBroken character encoding in pdf export
100%
Description
Hi,
There is a thread in the open discussion:
http://rubyforge.org/forum/forum.php?thread_id=13593&forum_id=7504
I attached the exported pdf and screenshot.
Files
Related issues
Updated by Nikolay Solakov over 17 years ago
I forgot... this is in my bg.yml lang file:
general_csv_encoding: windows-1251
general_pdf_encoding: windows-1251
Thanks,
Nikolay
Updated by Jean-Philippe Lang over 17 years ago
Since, rfpdf is a ruby port of fpdf, I've tried to add bulgarian
support following this tutorial:
http://www.fpdf.de/tutorials/7/
... with no result. I only get squares instead of cyrillic
characters.
Updated by Nikolay Solakov about 17 years ago
Can anyone solve this old puzzle?
Thanks,
Nikolay
Updated by Michael Pirogov almost 17 years ago
They says that (http://dry.4thebusiness.com/?document=3) they've
unicode support. Check out test_unicode link and see, that russian
and all other non-latin stuff is just fine.
Updated by Jan Topiński about 16 years ago
I think I've fixed that one. See bulg.pdf.
To fix it one needs to
- Update rfpdf to the newest version:
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
- Apply attached patch:
patch -p0 < 61.patch
Pdf export worked fine for me (Polish) and for Bulgarian.
Updated by Paul Rivier about 16 years ago
- Assignee set to Jean-Philippe Lang
Hello Jan,
thank you for this patch.
Can anybody with different locales try and confirm that UTF8 export now works well.
Jean-Philippe, any position on the current status of the pdf exporter in redmine ? I see 0.8 is planed for 7 weeks from now, do you think we can integrate the updated version of rfpdf and Jan's patch before feature-freeze ?
Updated by Jean-Philippe Lang about 16 years ago
- File redmine-2022_fr.pdf redmine-2022_fr.pdf added
- File redmine-2022_bg.pdf redmine-2022_bg.pdf added
I'd really like to fix it but it doesn't work for me.
Jan, after following the above instructions, pdf are broken (see attached french and bulgarian pdf). Any idea?
Paul, does the patch work for you?
Updated by Ernad Husremovic about 16 years ago
- File redmine-sc-15850.pdf redmine-sc-15850.pdf added
I can confirm that bosnian characters works well.
general_pdf_encoding: utf8
after rfpdf upgrade, pdf size is 314 KB (attached), before upgrade it was 2.5 KB. Obviously utf font is embedded into the pdf.
Updated by David Strejc about 16 years ago
I can confirm that this patch works for Czech language.
Updated by Sergej Jegorov about 16 years ago
I confirm, that patch works for Lithuanian language.
Updated by Azamat Hackimov about 16 years ago
Works fine for Russian. Tested for gannt and task. Is possible reduse filesize of generated PDF?
Updated by Jean-Philippe Lang about 16 years ago
French works with "vera" font.
A error is raised for japanese, traditional chinese and simplified chinese.
Updated by Jan Topiński about 16 years ago
I tried to fix Japanese and Chinese but I can't. I'm afraid that it's time to switch redmine to something like prawnto. I can volunteer to do it if you Jean think this is the right path.
Updated by Jan Topiński about 16 years ago
- File praw-pl-fr.pdf praw-pl-fr.pdf added
This two pdf files are generated with prawnto version of a issues index view. French-Polish praw-pl-fr.pdf seem ok Japanese is ok but latin fonts look ugly attachment:/praw-jp.pdf.
Updated by Jan Topiński about 16 years ago
- File praw-jp.png praw-jp.png added
I'm sorry Japanese file was too big and did not made to the page so I attach a screen-shot of it praw-jp.png.
Updated by Jean-Philippe Lang about 16 years ago
Jan, these pdf generated with prawnto look good (except the fact that praw-pl-fr.pdf contains the html layout).
If prawnto offers the required functionalities, switching would be a solution. Could you post the patch you used to generate these pdf ?
Updated by Jean-Philippe Lang about 16 years ago
I've made a few tests with prawn. It's much more easy to use than rfpdf but it's much slower. The generation of a list of 100 issues takes about 10s on my box (<1s with rfpdf). I'm afraid that it makes it unusable.
Updated by Jean-Philippe Lang about 16 years ago
- dejavusans: 3s
- comicsans: 1.75s
Updated by Eric Davis about 16 years ago
rfpdf
is causing my mongrels to die and timeout quite frequently now. It's happening so much that I'm turning off all PDF export on my installation. I'm interested in seeing how prawn performs against rfpdf with my issue data.
Updated by Jan Topiński about 16 years ago
- File prawn.patch prawn.patch added
To use it one needs to install prawnto:
- install prawn:
gem install prawn
- install prawnto:
script/plugin install git://github.com/thorny-sun/prawnto.git
Jean: the only problem apart of performance can be with gantt, there are some issues with prawn and png in tables. I will try to make the gantt pdf and we will see.
Updated by Heejong Lee about 16 years ago
- File prawn.patch prawn.patch added
Your patch causes permission denied error.
ActionView::TemplateError (Permission denied - index.pdf) on line #2 of issues/index.pdf.prawn: 1: Prawn::Document.generate('index.pdf', :page_layout => :landscape) do |pdf| 2: pdf.font(PdfHelper.font_for_lang(current_language)) 3: title = @project ? "#{@project.name} - #{l(:label_issue_plural)}" : "#{l(:label_issue_plural)}" 4: 5: pdf.header pdf.margin_box.top_left do
Use Document.new instead. Modified patch is attached.
Updated by Jean-Philippe Lang almost 16 years ago
- Status changed from Closed to New
Updated by Jean-Philippe Lang almost 16 years ago
- Subject changed from export to pdf to Broken character encoding in pdf export
Updated by Alexey Kornilov almost 16 years ago
- File export-4.png export-4.png added
We have hust upgraded to 0.8.4 release and the exported pdfs are now broken again. We are using Russian for our projects.
Formerly we have successefully used the 61.patch by Jan Topiński for version 0.8. Now it seems that the architecture has been changed, so the patch does not help anymore.
The screenshot is attached
Updated by Maxim Krušina over 15 years ago
- Priority changed from Normal to High
Hi there, any rpogress with ths issue?
Should I ask our guys to look on this issue?
Updated by Gyoung-Yoon Noh over 15 years ago
- File rfpdf-korean.diff rfpdf-korean.diff added
Exporting to PDF breaks Korean characters in trunk. I fixed this, but I am not sure that it is right solution. This fix is dependent on UnDotum font, which is included in unfonts package licensed by GPL.
Updated by Gyoung-Yoon Noh over 15 years ago
Gyoung-Yoon Noh wrote:
Exporting to PDF breaks Korean characters in trunk. I fixed this, but I am not sure that it is right solution. This fix is dependent on UnDotum font, which is included in unfonts package licensed by GPL.
Sorry, it does not depend on unfonts package. It will work on any UHC-inclusive font package.
Updated by Stanislav German-Evtushenko over 15 years ago
I have tried to change output fonts from Helvetica to FreeSans (Helvetica doesn't support Cyrillic). Font have been changed in output PDF but Cyrillic text is still unreadable.
Updated by Szymon Połom over 15 years ago
Can confirm this issue.
My last name is Połom but it gets exported as PoÅ‚om to a PDF.
Updated by Konstantin Ershov over 15 years ago
Also confirm that in Redmine 0.8.4 I have broken PDFs with cyrillic characters.
I have "Задача" instead of "Задача".
Updated by Konstantin Ershov over 15 years ago
- File pdf-0.8.4.patch pdf-0.8.4.patch added
Solved for Redmine 0.8.4.
Standart rfpdf was replaced with rfpdf from http://github.com/edwinmoss/rfpdf/zipball/master and then we made some changes mentioned above with lib/redmine/export/pdf.rb.
Patch is atached.
PS Exported PDF's include embedded fonts.
Updated by Subramanian N over 15 years ago
- Assignee changed from Jean-Philippe Lang to Paul Rivier
- % Done changed from 0 to 30
Nikolay Solakov wrote:
I forgot... this is in my bg.yml lang file:
general_csv_encoding: windows-1251
general_pdf_encoding: windows-1251Thanks,
Nikolay
Updated by Sergey Tatarenkov about 15 years ago
I and my friend have tested prawn.patch (http://www.redmine.org/attachments/1185/prawn.patch) (thanks to Jan Topiński and Heejong Lee). Cyrillic and Japanese symbols are displayed correctly. So prawn might be right solution.
Updated by chaninan jitonnom about 15 years ago
- Assignee deleted (
Paul Rivier)
i'm new in Redmine . when i change encoding in lang/th.yml file to
general_csv_encoding: utf8
general_pdf_encoding: utf8
after I follow above . Next i restart server and try to export PDF again on pdf link but it doesn't work
i don't know how to fixed them. Or I forgot or do something wrong. please tell me.
Updated by chaninan jitonnom about 15 years ago
- Assignee set to Jean-Philippe Lang
Quote: Jan Topiński
I think I've fixed that one. See bulg.pdf.
To fix it one needs to
1. Update rfpdf to the newest version:
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
2. Apply attached patch:
patch -p0 < 61.patch
Pdf export worked fine for me (Polish) and for Bulgarian.
Q: from above in step 2 . Apply attached patch how to operate it , patch -p0 < 61.patch, is it command or what?
Updated by Anonymous about 15 years ago
I've tested similar solution, but it does not work with Chinese and Japanese fonts.
Regards
KP
chaninan jitonnom wrote:
Quote: Jan Topiński
I think I've fixed that one. See bulg.pdf.To fix it one needs to
1. Update rfpdf to the newest version:
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
2. Apply attached patch:
patch -p0 < 61.patchPdf export worked fine for me (Polish) and for Bulgarian.
Q: from above in step 2 . Apply attached patch how to operate it , patch -p0 < 61.patch, is it command or what?
Updated by chaninan jitonnom about 15 years ago
- File prawn.patch prawn.patch added
Redmine ver.0.8.4 has code in app/controllers/issues_controller.rb line 70 different from this patch >> http://www.redmine.org/attachments/1181/prawn.patch
in patch 70 : format.pdf { send_data(render(:template => 'issues/index.rfpdf', :layout => false), :type => 'application/pdf', :filename => 'export.pdf') }
in Redmine v0.8.4 70 : format.pdf { send_data(issues_to_pdf(@issues, Herve Harster), :type => 'application/pdf', :filename => 'export.pdf') }
So, i change patch above to attached patch in order to able to apply with Redmine v0.8.4
but it also doesn't work .
Updated by Nikolay Kotlyarov almost 15 years ago
+1 for this issue. Export PDF is broken for Russian language.
Way to reproduce:
Select "My account" on the top of this page and change language to Russian or Bulgarian.
Then just export any issue from this site to PDF.
Updated by K S almost 15 years ago
- % Done changed from 0 to 100
Instructions for latest RFPDF (TCPDF):
The 61.patch sometimnes doesn't work correctly with redmine 0.8.7 stable.
Users can manually change this file: redmine-0.8.7/lib/redmine/export/pdf.rb and remove/change affested lines (see: http://www.redmine.org/attachments/1150/61.patch).
Propably You need also change this file: vendor/plugins/rfpdf/lib/rfpdf/template_handler/compile_support.rb and disable below lines:
- extend ActiveSupport::Memoizable
- memoize :ie_request?
- memoize :ssl_request?
Updated by K S almost 15 years ago
For polish coding you must change a redmine/lang/pl - pdf and cvs section to UTF-8 characters (not iso, if you use FreeSans font!).
Updated by Jeffrey Jones almost 15 years ago
I am late to the party on this one.
Does anyone have a list of steps that need to be followed to enable Japanese PDF output on 0.8.7-stable? I am looking through the history and it looks like I have to
1. update rfpdf
2. apply the 61.patch
3. Do the steps KS listed in previous post.
Is this correct?
Updated by Jeffrey Jones almost 15 years ago
- % Done changed from 100 to 70
Ok, so this is how I have managed to get it (half) working on 0.9.1
- Update RFPDF with
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
- Update redmine-0.8.7/lib/redmine/export/pdf.rb so that it matches http://www.redmine.org/attachments/1150/61.patch (NOTE: The patch changes some view files but these have been removed and all the AliasNBPages changes are also in the pdf.rb file)
- Edit vendor/plugins/rfpdf/lib/rfpdf/template_handler/compile_support.rb and comment out the following lines:
extend ActiveSupport::Memoizable memoize :ie_request? memoize :ssl_request?
Doing this means that I can output PDF files. HOWEVER these files can only display Hiragana and Katakana and cannot display Kanji, so practically useless at the moment.
Updated by Jeffrey Jones almost 15 years ago
Doing this means that I can output PDF files. HOWEVER these files can only display Hiragana and Katakana and cannot display Kanji, so > practically useless at the moment.
Thinking about it, this might be a font issue?
Updated by Kirill Ponomarev almost 15 years ago
Is there any progress in this issue?
Updated by Nikolay Kotlyarov almost 15 years ago
CSV export also broken in russian (Redmine 0.9.3)
Updated by Petr Pospisil over 14 years ago
- % Done changed from 70 to 30
Hi, PDF export has still broken some chars in czech language. I have latest RFPDF plugin, Redmine 0.9.3 and all texts are stored in UTF-8. Doesn't matter if you apply #61. How to make it works? Thanks.
Updated by Vladimir Kovacik over 14 years ago
Besides updating the rfpdf plugin and applying the patch you need to make sure your selected language locale uses "general_pdf_encoding: UTF-8".
Despite I'm Slovak I prefer english language for my user in Redmine. However english locale contained "general_pdf_encoding: ISO-8859-1" which obviously cause problem in case. I changed it to UTF-8 and now it works smoothly...
Updated by Igor Isaenko over 14 years ago
Problem still exist even in this version of redmine (on this site)
Try click on http://www.redmine.org/issues/61.pdf
Updated by Aleksander Palyan over 14 years ago
This patch for trunk version. It work for trunk version. Check please.
- Update RFPDF with
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
- Apply attached patch
Updated by Peter Volkov over 14 years ago
Works here too. Thank you Aleksander!
Updated by Alexey Palazhchenko over 14 years ago
New patch is basically the same as "pdf-0.8.4.patch" by Konstantin Ershov. I wonder why require 'rfpdf/chinese'
is commented out?
Updated by Aleksander Palyan over 14 years ago
Alexey Palazhchenko wrote:
New patch is basically the same as "pdf-0.8.4.patch" by Konstantin Ershov. I wonder why require
'rfpdf/chinese'
is commented out?
You are right. This row should be:
require 'fpdf/chinese'
Comment this because I didn't have time to research
Updated by Sin-young Kang about 14 years ago
- File 61-enhanced.patch 61-enhanced.patch added
I've enahnced Aleksander Palyan's patch for automatic enable/disable CJK helper modules by value of general_pdf_encoding
.
(because CJK helper modules will troubles when UTF-8/Unicode mode.)
but it need to change font manually.
for UTF-8/Unicode font job, follow this guide.
http://code.google.com/p/rfpdf/source/browse/trunk/lib/fonts/ttf2ufm/README.TXT
Updated by Leo Hourvitz about 14 years ago
I tried Sin-young's enhanced patch against redmine-1.0.1 on Mac OS X 10.6. I did change the pdf encoding in the locale to utf-8 but had no other problems in English or Japanese, excepting of course the elephant in the room: because of the font problem Jeffrey mentioned, you only get hiragana and katakana in the output, so it's structurally complete and yet useless for real work!
I tried to convert one of my .ttf Japanese fonts with the ttf2utm utility but I couldn't get it to output a valid file.
Updated by Ahmed Skaik about 14 years ago
- File arabic_PDF.png arabic_PDF.png added
any idea if any of these patches work for Arabic PDF and CSV export ?
Check attachment
Thanks
Updated by Diego Felipe about 14 years ago
Hi, after updating the RFPDF my application stopped to work. I also applied this 61 patch, But the problem persists.
What did I do wrong?
Here is the stack trace:
A source file that the application requires, is missing.
Error message:
no such file to load -- rfpdf/fpdf (MissingSourceFile)
0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
1 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `require'
2 /srv/apps/redmine-1.0.1/vendor/rails/activesupport/lib/active_support/dependencies.rb 158 in `require'
3 /srv/apps/redmine-1.0.1/lib/redmine/export/pdf.rb 21
[..]
Line 21 is the "require 'rfpdf/fpdf'"
Any help?
Updated by Aleksander Palyan about 14 years ago
Diego Felipe wrote:
Hi, after updating the RFPDF my application stopped to work. I also applied this 61 patch, But the problem persists.
What did I do wrong?
Here is the stack trace:
A source file that the application requires, is missing.
Error message:
no such file to load -- rfpdf/fpdf (MissingSourceFile)
0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
1 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `require'
2 /srv/apps/redmine-1.0.1/vendor/rails/activesupport/lib/active_support/dependencies.rb 158 in `require'
3 /srv/apps/redmine-1.0.1/lib/redmine/export/pdf.rb 21
[..]Line 21 is the "require 'rfpdf/fpdf'"
Any help?
It should to be "require 'fpdf/chinese'"
Updated by John Yani about 14 years ago
3 years passed. Could someone please to summarize, what is the progress? And when is it supposed to be fixed?
Updated by Petr Pospisil almost 14 years ago
Czech characters in a PDF export are all right only when I have a unix OS, latest rfpdf and applied 61.patch. On a windows only digits and parenthesis are shown. Do you know any workaround? Thx.
(others fonts from latest rfpdf doesn't work due to a lot of issues inside)
Updated by Dmitriy Jamaro almost 14 years ago
In version 1.1.0 this method does not help.
who knows how to beat this problem?
Updated by Yuriy Vidineev almost 14 years ago
- File 61-1.1.patch 61-1.1.patch added
I modified 61.patch from Aleksander Palyan to work with redmine 1.1.0. Its work for me with redmine 1.1+nginx+mod_passenger+debian
Updated by Etienne Massip almost 14 years ago
- Target version set to Candidate for next major release
Updated by Jun NAITOH over 13 years ago
- File korean.rb_rfpdf115.patch korean.rb_rfpdf115.patch added
- File pdf.rb_rfpdf115.patch pdf.rb_rfpdf115.patch added
- File gantt.rb_rfpdf115.patch gantt.rb_rfpdf115.patch added
- File locales_rfpdf115.patch locales_rfpdf115.patch added
- File chinese.rb_rfpdf115.patch chinese.rb_rfpdf115.patch added
- File japanese.rb_rfpdf115.patch japanese.rb_rfpdf115.patch added
I merged 61-1.1.patch and #6505 note 9 patch.
This patch supports Japanese/Chinese/Korean and another language. (sorry, not support Thai, only.)
This patch for Redmine 1.1.2 version. Check please.¶
- Update RFPDF with http://github.com/edwinmoss/rfpdf/zipball/master
- Apply attached patch to Updated RFPDF (RFPDF's bug fix):
- japanese.rb_rfpdf115.patch
- korean.rb_rfpdf115.patch
- chinese.rb_rfpdf115.patch
- Apply attached patch to Redmine:
- pdf.rb_rfpdf115.patch
- gantt.rb_rfpdf115.patch
- locales_rfpdf115.patch (set "general_pdf_encoding: UTF-8" )
Changed by this patch.¶
general_pdf_encoding | IFPDF's parent class | font | support locale | reason |
not UTF-8 | FPDF | UHC,SJIS, GB, Big5, Helvetica | ja,ko,zh, zh-TW | FreeSans doesn't support Japanese/Chinese/Korean/Thai character |
UTF-8 | TCPDF | FreeSans | other | Helvetica doesn't support Cyrillic |
- Sorry, Thai character can't use. Because, I can't find Font that supports Thai.
Updated by Toshi MARUYAMA over 13 years ago
- Assignee changed from Jean-Philippe Lang to Toshi MARUYAMA
Updated by Toshi MARUYAMA over 13 years ago
I imported Jun's patches and pushed my bitbucket and github repository.
- https://bitbucket.org/marutosi/redmine-issue61-pdf
- https://github.com/marutosi/redmine/commits/bb-issue61-pdf
Please try it.
Updated by Toshi MARUYAMA over 13 years ago
I got an error in Gantt PDF on Japanese locale.
NoMethodError in GanttsController#show You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] RAILS_ROOT: /REDMINE-1/hg-git/redmine-chili-mix-1 Application Trace | Framework Trace | Full Trace /REDMINE-1/hg-git/redmine-chili-mix-1/vendor/plugins/rfpdf/lib/fpdf/japanese.rb:89:in `GetStringWidth' /REDMINE-1/hg-git/redmine-chili-mix-1/vendor/plugins/rfpdf/lib/tcpdf.rb:1707:in `Cell' /REDMINE-1/hg-git/redmine-chili-mix-1/lib/redmine/export/pdf.rb:127:in `UTF8Cell' /REDMINE-1/hg-git/redmine-chili-mix-1/lib/redmine/helpers/gantt.rb:517:in `to_pdf' /REDMINE-1/hg-git/redmine-chili-mix-1/app/controllers/gantts_controller.rb:28:in `show' /REDMINE-1/hg-git/redmine-chili-mix-1/app/controllers/gantts_controller.rb:25:in `show'
Updated by Jun NAITOH over 13 years ago
I checked https://github.com/marutosi/redmine/commits/bb-issue61-pdf.
It's correct patched source.
I tried it in Japanese locale, so The same error occurred in production mode.
but, in development mode (RAILS_ENV = 'development'), I don't detect error. why?
I tried to debug. I found...
I changed by way of experiment as follows. so, it doesn't detect error...
# class IFPDF < (l(:general_pdf_encoding).upcase == 'UTF-8' ? TCPDF : FPDF ) class IFPDF < (l(:general_pdf_encoding).upcase != 'UTF-8' ? TCPDF : FPDF )
# alias alias_nb_pages AliasNbPages if l(:general_pdf_encoding).upcase != 'UTF-8' alias alias_nb_pages AliasNbPages if l(:general_pdf_encoding).upcase == 'UTF-8'
I think that TCPDF is called by mistake in Japanese locale....
Updated by Jun NAITOH over 13 years ago
sorry, I changed by way of experiment file name is "lib/redmine/export/pdf.rb"
Updated by Toshi MARUYAMA over 13 years ago
Toshi MARUYAMA wrote:
I imported Jun's patches and pushed my bitbucket and github repository.
I noticed these repositories have ".svn/" meta data.
I re-generated revision history.
Please use bb-issue61-pdf-1 git branch.
On Mercurial, I created new named branch "issue61-pdf-1".
Updated by Jun NAITOH over 13 years ago
- File gantt.rb_rfpdf115_2.patch gantt.rb_rfpdf115_2.patch added
- File pdf.rb_rfpdf115_2.patch pdf.rb_rfpdf115_2.patch added
- File gantt.rb gantt.rb added
- File pdf.rb pdf.rb added
Toshi MARUYAMA wrote:
I got an error in Gantt PDF on Japanese locale.
[...]
Sorry, I had tested in development mode.
Note 69 patch has problem in production mode.
I rewrote pdf.rb_rfpdf115.patch(pdf.rb_rfpdf115_2.patch) and gantt.rb_rfpdf115.patch(gantt.rb_rfpdf115_2.patch).
This patch's logic same.
And, the pdf.rb and gantt.rb files(for Toshi's github) is appended, too.
Updated by Jun NAITOH over 13 years ago
- File tcpdf_binary.patch tcpdf_binary.patch added
tcpdf_binary.patch fixed the problem that TCPDF built-in font breaks in the Windows environment.
This problem occurs because the EOF character string is included in the built-in font.
I tested by BitNami(Redmine 1.1.2) on Windows XP sp3(Japanese).
Updated by Jun NAITOH over 13 years ago
I'm sorry, my correct test environment is the following.
I tested by BitNami(Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese), and English locale.
Jun NAITOH wrote:
I tested by BitNami(Redmine 1.1.2) on Windows XP sp3(Japanese).
Updated by Jun NAITOH over 13 years ago
- File r5258_chinese.rb.patch r5258_chinese.rb.patch added
- File chinese_trunk.pdf chinese_trunk.pdf added
- File chinese_trunk_patched.pdf chinese_trunk_patched.pdf added
r5258_chinese.rb.patch corrects the width calculation of multi byte character for chinese.rb.
r5258_chinese.rb.patch is an additional patch to r5258.
This is related to #1170 patch.
Redmin 1.1.2 chinese.rb logic (Please see #1170.)¶
- UTF-8(3byte) --> MultiCell(chinese.rb) -->
- -- UTF-8(3byte) --> Cell(pdf.rb : use iconv) -->
- -- zh(2byte) --> Cell(fpdf.rb)
This patch's logic¶
- UTF-8(3byte) --> RDMMultiCell(pdf.rb) -->
- -- UTF-8(3byte) --> fix_text_encoding(pdf.rb : use iconv) -- zh(2byte) --> MultiCell(chinese.rb) -->
- -- zh(2byte) --> Cell(fpdf.rb)
Sample (zh locale test)¶
- chinese_trunk.pdf : trunk now
- chinese_trunk_patched.pdf : trunk + patch
Updated by Jun NAITOH over 13 years ago
- File pdf_ruby19.patch pdf_ruby19.patch added
pdf_ruby19.patch is for Ruby1.9 compatibility on FPDF (Japanese/Chinese/Korean)
When I tested, TCPDF is already compatible with Ruby 1.9.
My test environment is as follows.¶
- Ruby1.9 compatibility Test
- CentOS 5.5(x86)
- Ruby 1.9.2 + rails 2.3.11 + i18n-0.4.2 + trunk
- Ruby1.8 compatibility Test
- BitNami(Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese)
Updated by Jun NAITOH over 13 years ago
Sorry, note 82 patch don't work on ruby 1.8.6.
"ord" method is ruby 1.8.7 and 1.9 later.
Please wait, I rewite patch.
Updated by Jun NAITOH over 13 years ago
- File pdf_ruby19.patch2 pdf_ruby19.patch2 added
I rewrote pdf_ruby19.patch2 for trunk.
My test environment is as follows.
- Ruby1.9 compatibility Test
- CentOS 5.5(x86) Ruby 1.9.2 + rails 2.3.11 + i18n-0.4.2 + trunk
- Ruby1.8 compatibility Test
- BitNami(Ruby 1.8.7 + Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese)
- CentOS 5.5(x86) Ruby 1.8.6 + rails 2.3.11 + i18n-0.4.2 + trunk
Updated by Jun NAITOH over 13 years ago
pdf.rb_illegal_character.patch is support for include illegal character string case.
Updated by Toshi MARUYAMA over 13 years ago
- Target version changed from Candidate for next major release to 1.2.0
- % Done changed from 70 to 100
Updated by staccatissimo Lee over 13 years ago
Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?
Updated by Toshi MARUYAMA over 13 years ago
staccatissimo Lee wrote:
Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?
I finished commiting Jun's patches to SVN trunk.
Please checkout SVN trunk or clone github or bitbucket mirror and test it.
Updated by staccatissimo Lee over 13 years ago
Toshi MARUYAMA wrote:
staccatissimo Lee wrote:
Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?
I finished commiting Jun's patches to SVN trunk.
Please checkout SVN trunk or clone github or bitbucket mirror and test it.
Thanks man, I tried "svn co http://redmine.rubyforge.org/svn/trunk redmine". but my redmine still export strange code when message is written in Chinese. Is there anything I missed?
Updated by Toshi MARUYAMA over 13 years ago
Thank you for your feedback.
Could you give us pdf and screen shot?
Updated by staccatissimo Lee over 13 years ago
- File 20110408-01.png 20110408-01.png added
steps I have tried:
"svn co http://redmine.rubyforge.org/svn/trunk redmine"
Updated by Toshi MARUYAMA over 13 years ago
- File issue-list.png issue-list.png added
- File freesans-font.png freesans-font.png added
- File english.pdf english.pdf added
- File Simplified-Chinese.pdf Simplified-Chinese.pdf added
Check your database encoding is UTF-8.
MySQL default encoding is Latin-1(ISO-8859-1).
In English locale, Redmine trunk uses embedded FreeSans font.
FreeSans does not have Chinese HANJI (漢字).
In Simplified and Traditional Chinese locale, Redmine trunk uses non embedded font.
Updated by Toshi MARUYAMA over 13 years ago
Please see http://en.fonts2u.com/free-sans .
Updated by staccatissimo Lee over 13 years ago
- File 20110408-02.png 20110408-02.png added
Thanks for your prompt response!
The database should be in UTF-8, as it could display Chinese on the Redmine web interface.
As of locale, thank you very much for the inspiration.
The PDF is in good shape when I switch to Chinese Interface.
Is there anyway I could use English interface and generate Chinese PDF.
p.s. Attached pls find the screenshots
Updated by Toshi MARUYAMA over 13 years ago
staccatissimo Lee wrote:
Is there anyway I could use English interface and generate Chinese PDF.
There is no way for some reasons.
- FreeSans font does not have HANJI (漢字), but it has Japanese HIRAGANA (ひらがな) and KATAKANA (カタカナ).
- Unified CJK problem.
- I am Japanese. Japanese can not accept free font quality.
Updated by Toshi MARUYAMA over 13 years ago
CJK Unified Ideographs
http://en.wikipedia.org/wiki/CJK_Unified_Ideographs
Updated by Toshi MARUYAMA over 13 years ago
staccatissimo Lee wrote:
The database should be in UTF-8, as it could display Chinese on the Redmine web interface.
If your database is MySQL, try following command.
mysql> show variables like "char%"; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+
Updated by staccatissimo Lee over 13 years ago
Toshi MARUYAMA wrote:
staccatissimo Lee wrote:
Is there anyway I could use English interface and generate Chinese PDF.
There is no way for some reasons.
- FreeSans font does not have HANJI (漢字), but it has Japanese HIRAGANA (ひらがな) and KATAKANA (カタカナ).
- Unified CJK problem.
- I am Japanese. Japanese can not accept free font quality.
Dear Toshi,
Thank you very much! Your advices are very helpful!
Now I managed to Print PDF in with Chinese correctly.
One more think to add, is there any way I could change to font type? It is because the Chinese PDF does not look good, although the display is correct. Is there any way I could modify the RFPDF so to change the font name?
Updated by Toshi MARUYAMA over 13 years ago
staccatissimo Lee wrote:
One more think to add, is there any way I could change to font type? It is because the Chinese PDF does not look good, although the display is correct. Is there any way I could modify the RFPDF so to change the font name?
Font names are hard-coded at source:trunk/vendor/plugins/rfpdf/lib/fpdf/chinese.rb#L80 .
Updated by Toshi MARUYAMA over 13 years ago
You can change font name to edit source:trunk/lib/redmine/export/pdf.rb#L102 .
Updated by Yuriy Vidineev over 13 years ago
works great with cyrillic. Thank you!
Updated by Jun NAITOH over 13 years ago
- File pdf_encoding.patch pdf_encoding.patch added
- File locales_encoding.patch locales_encoding.patch added
- File encoding.png encoding.png added
staccatissimo Lee wrote:
Is there anyway I could use English interface and generate Chinese PDF.
pdf_encoding.patch and locales_encoding.patch switch to use to "general_pdf_encoding" from "current_language".
If you are an English locale(use en.yml), set "general_pdf_encoding: gb18030" in en.yml.
So you can use English interface and generate Chinese PDF.
Updated by Jun NAITOH over 13 years ago
I found 0x5c char handling bug, for Japanese and Chinese PDF. (Korean PDF don't have 0x5c char handling problem.)
I had done the 0x5c escape processing before using japanese.rb (chinese.rb).
Therefore, the mistake occurred in byte calculation because the number of 0x5c escape characters increased.
sample : This problem occurs by the character string that contains 0x5c.
能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能
And, I found the bug of the 0x5c escape processing of FPDF. (This bug has already been fixed in TCPDF.)
Updated by Toshi MARUYAMA over 13 years ago
- Status changed from New to Closed
- Resolution set to Fixed
Summary¶
general_pdf_encoding | Class | Font name | Font type | Support locales | |
Not UTF-8 | FPDF | UHC,SJIS, GB, Big5, Helvetica | Non embedded | ja,ko,zh, zh-TW | FreeSans doesn't support Japanese/Chinese/Korean/Thai characters |
UTF-8 | TCPDF | FreeSans | Embedded | Others | Helvetica doesn't support Cyrillic |
If you have a problem, please create a new issue.