[trunk] Stock Level Forecast encode char regression

Bug #1083486 reported by Paulius Sladkevičius @ hbee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Wishlist
OpenERP R&D Addons Team 2

Bug Description

Please check below trace which I got when tried to print Stock Level Forecast report from a product, which product name have our native language chars.

rev: 8118

openerp.service.web_services: Exception: 'charmap' codec can't encode character u'\u0117' in position 5: character maps to <undefined>
Traceback (most recent call last):
  File "/home/komsas/openerp/trunk/server/trunk/openerp/service/web_services.py", line 736, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/komsas/openerp/trunk/addons/trunk/stock/report/product_stock.py", line 110, in create
    gt.draw()
  File "/home/komsas/openerp/trunk/addons/trunk/stock/report/stock_graph.py", line 102, in draw
    ar.draw(self._canvas)
  File "/usr/lib/python2.7/site-packages/pychart/area.py", line 248, in draw
    self.legend.draw(self, legends, can)
  File "/usr/lib/python2.7/site-packages/pychart/legend.py", line 178, in draw
    l.draw(ar, can, this_x, this_x + max_sample_width[col], this_y)
  File "/usr/lib/python2.7/site-packages/pychart/legend.py", line 88, in draw
    can.show(x_label, y, self.label)
  File "/usr/lib/python2.7/site-packages/pychart/basecanvas.py", line 503, in show
    self.text_show(font_name, nscale(size), color, str)
  File "/usr/lib/python2.7/site-packages/pychart/pdfcanvas.py", line 171, in text_show
    self.__write("(%s) Tj " % (str.encode('mac_roman')))
  File "/usr/lib64/python2.7/encodings/mac_roman.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u0117' in position 5: character maps to <undefined>

Related branches

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I have faced the same issue when I am creating a product name with '中文产品' and try to print 'Stock level forecast' report.

@Assigned Team : Would you please checked lp:1007854 and lp:956798.

Thank you!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Medium
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Changed in openobject-addons:
status: In Progress → Confirmed
Changed in openobject-addons:
importance: Medium → Wishlist
Revision history for this message
Arnaud Pineux (OpenERP) (api-openerp) wrote :

This bug doesn't belong to OpenERP, it's a problem from PYCHART.
PYCHART is a library that provides chart and legend but unfortunately this library doesn"t handle special utf-8 characters such as chinese and korean.
As we will not fix the PYCHART library, we decided to catch those special characters and we replace them by "?" to avoid a crach.

Good luck to everyone,

API

Changed in openobject-addons:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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