Vote #62059
完了Broken character encoding in pdf export
100%
説明
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.
journals
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.
--------------------------------------------------------------------------------
have you found an answer?
--------------------------------------------------------------------------------
Can anyone solve this old puzzle?
Thanks,
Nikolay
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
I forgot... this is in my bg.yml lang file:
general_csv_encoding: windows-1251
general_pdf_encoding: windows-1251
Thanks,
Nikolay
--------------------------------------------------------------------------------
I think I've fixed that one. See attachment:bulg.pdf.
To fix it one needs to
# Update rfpdf to the newest version:
<code>script/plugin install git://github.com/edwinmoss/rfpdf.git --force</code>
# Apply attached patch:
<code>patch -p0 < 61.patch</code>
Pdf export worked fine for me (Polish) and for Bulgarian.
--------------------------------------------------------------------------------
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 ?
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
I can confirm that bosnian characters works well.
<pre>
general_pdf_encoding: utf8
</pre>
after rfpdf upgrade, pdf size is 314 KB (attached), before upgrade it was 2.5 KB. Obviously utf font is embedded into the pdf.
--------------------------------------------------------------------------------
I can confirm that this patch works for Czech language.
--------------------------------------------------------------------------------
I confirm, that patch works for Lithuanian language.
--------------------------------------------------------------------------------
Works fine for Russian. Tested for gannt and task. Is possible reduse filesize of generated PDF?
--------------------------------------------------------------------------------
French works with "vera" font.
A error is raised for japanese, traditional chinese and simplified chinese.
--------------------------------------------------------------------------------
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":http://cracklabs.com/prawnto. I can volunteer to do it if you Jean think this is the right path.
--------------------------------------------------------------------------------
This two pdf files are generated with prawnto version of a issues index view. French-Polish attachment:praw-pl-fr.pdf seem ok Japanese is ok but latin fonts look ugly attachment:/praw-jp.pdf.
--------------------------------------------------------------------------------
I'm sorry Japanese file was too big and did not made to the page so I attach a screen-shot of it attachment:praw-jp.png.
--------------------------------------------------------------------------------
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 ?
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Looks like it's faster when using ttf fonts:
* dejavusans: 3s
* comicsans: 1.75s
--------------------------------------------------------------------------------
@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.
--------------------------------------------------------------------------------
Requested patch is here attachment:prawn.patch (for testing only).
To use it one needs to install prawnto:
# install prawn:
<code>gem install prawn</code>
# install prawnto:
<code>script/plugin install git://github.com/thorny-sun/prawnto.git</code>
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.
--------------------------------------------------------------------------------
Your patch causes permission denied error.
<pre>
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
</pre>
Use Document.new instead. Modified patch is attached.
--------------------------------------------------------------------------------
Dup of #61.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
Hi there, any rpogress with ths issue?
Should I ask our guys to look on this issue?
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Can confirm this issue.
My last name is _Połom_ but it gets exported as _PoÅ‚om_ to a PDF.
--------------------------------------------------------------------------------
Also confirm that in Redmine 0.8.4 I have broken PDFs with cyrillic characters.
I have "Задача" instead of "Задача".
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Nikolay Solakov wrote:
> I forgot... this is in my bg.yml lang file:
> general_csv_encoding: windows-1251
> general_pdf_encoding: windows-1251
>
> Thanks,
> Nikolay
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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.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?
--------------------------------------------------------------------------------
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, @project), :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 .
--------------------------------------------------------------------------------
+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.
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
*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!).*
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
Ok, so this is how I have managed to get it (half) working on 0.9.1
# Update RFPDF with
<pre>
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
</pre>
# 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:
<pre>
extend ActiveSupport::Memoizable
memoize :ie_request?
memoize :ssl_request?
</pre>
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.
--------------------------------------------------------------------------------
> 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?
--------------------------------------------------------------------------------
Is there any progress in this issue?
--------------------------------------------------------------------------------
CSV export also broken in russian (Redmine 0.9.3)
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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...
--------------------------------------------------------------------------------
Problem still exist even in this version of redmine (on this site)
Try click on http://www.redmine.org/issues/61.pdf
--------------------------------------------------------------------------------
This patch for trunk version. It work for trunk version. Check please.
# Update RFPDF with
<pre>
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
</pre>
# Apply attached patch
--------------------------------------------------------------------------------
This patch works fine for me.
--------------------------------------------------------------------------------
Works here too. Thank you Aleksander!
--------------------------------------------------------------------------------
New patch is basically the same as "pdf-0.8.4.patch" by Konstantin Ershov. I wonder why require @'rfpdf/chinese'@ is commented out?
--------------------------------------------------------------------------------
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:
<pre>
require 'fpdf/chinese'
</pre>
Comment this because I didn't have time to research
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
any idea if any of these patches work for Arabic PDF and CSV export ?
Check attachment
Thanks
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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'"
--------------------------------------------------------------------------------
3 years passed. Could someone please to summarize, what is the progress? And when is it supposed to be fixed?
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
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)
--------------------------------------------------------------------------------
In version 1.1.0 this method does not help.
who knows how to beat this problem?
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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.)
h3. 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" )
h2. 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.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
I got an error in Gantt PDF on Japanese locale.
<pre>
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'
</pre>
--------------------------------------------------------------------------------
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...
<pre>
# class IFPDF < (l(:general_pdf_encoding).upcase == 'UTF-8' ? TCPDF : FPDF )
class IFPDF < (l(:general_pdf_encoding).upcase != 'UTF-8' ? TCPDF : FPDF )
</pre>
<pre>
# 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'
</pre>
I think that TCPDF is called by mistake in Japanese locale....
--------------------------------------------------------------------------------
sorry, I changed by way of experiment file name is "lib/redmine/export/pdf.rb"
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> 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
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".
* https://bitbucket.org/marutosi/redmine-issue61-pdf
* https://github.com/marutosi/redmine/commits/bb-issue61-pdf-1
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
tcpdf_binary.patch fixed the problem that TCPDF built-in font breaks in the Windows environment.
This problem occurs because the EOF(0x1a) character string is included in the built-in font.
I tested by BitNami(Redmine 1.1.2) on Windows XP sp3(Japanese).
--------------------------------------------------------------------------------
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).
--------------------------------------------------------------------------------
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.
h2. 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)
h2. 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)
h3. Sample (zh locale test)
* chinese_trunk.pdf : trunk now
* chinese_trunk_patched.pdf : trunk + patch
--------------------------------------------------------------------------------
pdf_ruby19.patch is for Ruby1.9 compatibility on FPDF (Japanese/Chinese/Korean)
When I tested, TCPDF is already compatible with Ruby 1.9.
h3. 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)
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
pdf.rb_illegal_character.patch is support for include illegal character string case.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
Thank you for your feedback.
Could you give us pdf and screen shot?
--------------------------------------------------------------------------------
steps I have tried:
"svn co http://redmine.rubyforge.org/svn/trunk redmine"
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Please see http://en.fonts2u.com/free-sans .
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
CJK Unified Ideographs
http://en.wikipedia.org/wiki/CJK_Unified_Ideographs
--------------------------------------------------------------------------------
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.
<pre>
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/ |
+--------------------------+----------------------------+
</pre>
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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 .
--------------------------------------------------------------------------------
You can change font name to edit source:trunk/lib/redmine/export/pdf.rb#L102 .
--------------------------------------------------------------------------------
works great with cyrillic. Thank you!
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
<pre>
能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能
</pre>
And, I found the bug of the 0x5c escape processing of FPDF. (This bug has already been fixed in TCPDF.)
--------------------------------------------------------------------------------
h2. 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.
--------------------------------------------------------------------------------
related_issues
relates,Closed,3794,UTF in issue generated report
relates,Closed,4375,how to export PDF in Thai using Redmine 0.8.7
relates,Closed,4708,export to PDF do not work correctly with Czech language
relates,Closed,7287,PDF Export Turkish characters not showing
relates,Closed,7794,Internal server error on formatting an issue as a PDF in Japanese
relates,Closed,4787,Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ?
relates,Closed,9,Export feature(to csv/pdf) doesn't work (in Japanese)
relates,Closed,7373,Error with PDF output and ruby 1.9.2
relates,Closed,5629,Wrap text fields properly in PDF
relates,Closed,8312,Switch to TCPDF from FPDF for PDF export
relates,Closed,5024,Internal error after clicking on link to PDF Export
relates,Closed,8565,JRuby: Japanese PDF export error
relates,Closed,8566,Exported PDF UTF-8 Vietnamese not correct
relates,Closed,69,Textilized description in PDF
relates,Closed,11927,Vietnamese Unicode charater broken when exporting to PDF
duplicates,Closed,76,PDF fonts must be in UTF-8
duplicates,Closed,856,Export issue to PDF - broken character encoding
duplicates,Closed,3092,Wrong encoding in Gantt / PDF export
duplicates,Closed,3894,Wrong encoding in PDF export with Korean
duplicates,Closed,4012,Out Of The Box full PDF internationalization
duplicates,Closed,4220,Export to PDF in thai language it doesn't work
duplicates,Closed,5064,Garbled or unsupported characters in PDF output (utf-8)
duplicates,Closed,6999,Export PDF is broken for Mongolian language
duplicates,Closed,4699,Export PDF in Chinese and Japanese language is get well in redmine 0.8.7
duplicates,Closed,5884,PDF export doesn't work for Hebrew
duplicates,Closed,6505,PDF export broken with Japanese (Gannt and Issue Tracking)
duplicates,Closed,7019,Issue pdf export
duplicates,Closed,7833,pdf export problem
duplicates,Closed,6506,Gantt chart export to PDF/PNG works incorrectly in zh-tw locale
duplicates,Closed,7461,Special chars / umlauts broken in CSV / PDF export
duplicates,Closed,8455,Cyrillic output in PDF