[trunk] Euro-sign and other 'strange chars' not displayed correctly

Bug #322930 reported by EdbO
2
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

Used software: trunk of 29-01-2009 @ 22:00 (CentOS 5.2 with python 2.4)

'Strange chars' like ä á à ß Ô Ú Â and so on are not printed correctly. I got e.g. a € for the € sign. Trying to use another encoding doesn't work.

Maybe there is already a bug reported for this, but I can't find it.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

We decided to create a addons-extra to manage unicode fonts using dejavu.
Wait for this module.

Changed in openobject-server:
status: New → Invalid
Revision history for this message
EdbO (edbo-design-deactivatedaccount) wrote :

Why is it working with RC3 on Fedora 10?

Revision history for this message
EdbO (edbo-design-deactivatedaccount) wrote :

Why creating a new module? The solution is so simple! I found the solution on the forum, suggested by Intersol ( http://openerp.com/forum/post15847.html#15847 ) .

#--- intersol DejaVu fornt patch for enabling UTF-8 support in normal reports
import reportlab.rl_config
reportlab.rl_config.warnOnMissingFontGlyphs = 0

from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics

pdfmetrics.registerFont(TTFont('Times-Roman','DejaVuSerif.ttf'))
pdfmetrics.registerFont(TTFont('Times-BoldItalic','DejaVuSerifBoldItalic.ttf'))
pdfmetrics.registerFont(TTFont('Times-Bold','DejaVuSerifBold.ttf'))
pdfmetrics.registerFont(TTFont('Times-Italic','DejaVuSerifItalic.ttf'))

#pdfmetrics.registerFont(TTFont('Helvetica','DejaVuSans.ttf'))
# disabled: this one does give an error, should be investigated
pdfmetrics.registerFont(TTFont('Helvetica-BoldItalic','DejaVuSansBoldOblique.ttf'))
pdfmetrics.registerFont(TTFont('Helvetica-Bold','DejaVuSansBold.ttf'))
pdfmetrics.registerFont(TTFont('Helvetica-Italic','DejaVuSansOblique.ttf'))

pdfmetrics.registerFont(TTFont('Courier','DejaVuMonoSans.ttf'))
pdfmetrics.registerFont(TTFont('Courier-Bold','DejaVuMonoSansBold.ttf'))
#--- end of patch

I've added the above in bin/report/render/rml2pdf/trml2pdf.py starting at line 57 just below the import-section. Instead of the Dejavu-fonts I'm using the Arial-fonts, which I added to /usr/lib/python2.4/site-packages/reportlab/fonts

Got my Euro-sign back and the 'strange chars'.

Maybe there is a possibility to make a config-option for the fonttypes.

Changed in openobject-server:
status: Invalid → New
Revision history for this message
EdbO (edbo-design-deactivatedaccount) wrote :

I've added a sample-pdf.

You have to change the 'Helvetica'-font on the reports to a different font. In my case I've also added
pdfmetrics.registerFont(TTFont('Arial','arial.ttf')) to the file. ReportLab uses 'Helvetica' as it's standard font, so it cannot be changed.

On my reports I changed every para-style with the Helvetica-font with the defined Arial-font.

The result is the attached PDF.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Because:
1. v5 is frozen, we can not add new feature now. Putting it as a module will allow to publish it in february.
2. DejaVU fonts are heavy (several Mbs), I don't want to include them in each report (or sever code) for those that do not need them. So, only companies that need to use unicode report will use it.
3. I am not sure this solution is the best, and we have no time to check this. V5 is the priority.

Changed in openobject-server:
status: New → Invalid
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [Bug 322930] Re: [trunk] Euro-sign and other 'strange chars' not displayed correctly

Can you create a blueprint, so that we don't forget to planify this for
after v5 ?
Thanks,

EdbO wrote:
> I've added a sample-pdf.
>
> You have to change the 'Helvetica'-font on the reports to a different font. In my case I've also added
> pdfmetrics.registerFont(TTFont('Arial','arial.ttf')) to the file. ReportLab uses 'Helvetica' as it's standard font, so it cannot be changed.
>
> On my reports I changed every para-style with the Helvetica-font with
> the defined Arial-font.
>
> The result is the attached PDF.
>
> ** Attachment added: "openerp_test_chars.pdf"
> http://launchpadlibrarian.net/21856029/openerp_test_chars.pdf
>

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
   -- Marty, 2005

Revision history for this message
EdbO (edbo-design-deactivatedaccount) wrote :
Revision history for this message
digitalsatori(Shine IT) (digitalsatori) wrote :

Considering the Eastern Aisan language support, the solution of using Dejavu font as the replacement font is not a once and for all solution. Do we have have better ideas?

Revision history for this message
Dukai Gábor (gdukai) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.