← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 718651] Re: importing a translation with arabic characters fails

 

On Monday 14 February 2011, you wrote:
> hmm weird.. the arabic characters are truncated when i open the file in
> gedit on the server. i edited the file in wordpad under windows. opening
> any .po file from the i18n folder from any module displays proper arabic
> though.

Well, as a general advice, _avoid_ wordpad. For any task. Ever.

You see, utf8 has 2-3bytes per char. If you truncate the bytes, the text file 
becomes 'broken'. It's the only character encoding that can have that, in the 
history of computing. And, then, there is nothing more the end application, 
like OpenERP, can do.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/718651

Title:
  importing a translation with arabic characters fails

Status in OpenERP Server:
  New

Bug description:
  if i export a translation file for all modules, make my changes
  according to the desired language which is arabic in this case, and
  try to reimport it, i get an encoding error.

  Traceback (most recent call last):
    File "/usr/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/usr/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/usr/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/usr/lib/python2.6/site-packages/openerp-server/addons/base/module/wizard/base_import_language.py", line 59, in import_lang
      tools.trans_load_data(cr, fileobj, fileformat, import_data.code, lang_name=import_data.name)
    File "/usr/lib/python2.6/site-packages/openerp-server/tools/translate.py", line 932, in trans_load_data
      trans_obj.create(cr, uid, dic)
    File "/usr/lib/python2.6/site-packages/openerp-server/addons/base/ir/ir_translation.py", line 184, in create
      ids = super(ir_translation, self).create(cursor, user, vals, context=context)
    File "/usr/lib/python2.6/site-packages/openerp-server/osv/orm.py", line 3605, in create
      cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
    File "/usr/lib/python2.6/site-packages/openerp-server/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/usr/lib/python2.6/site-packages/openerp-server/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  DataError: invalid byte sequence for encoding "UTF8": 0xc3cd
  HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".

  the db's encoding is utf-8. if i reimport it without using any arabic
  characters, it works fine.





References