cubicweb #1381228 weird encoding error when storing a File entity [rejected]

When I want to process this migration script:

import os
from os.path import dirname, join, abspath
from cubicweb import Binary
logo = abspath("test/data/acceptance/Shell_logo_1.gif")
assert os.path.exists(logo)
data = Binary(open(logo, "rb").read())
create_entity("File", data_name=u"FICHIER", data=data)

I got this error:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/juj/src/fcubicweb/cubicweb/server/migractions.py", line 1362, in cmd_create_entity
  entity = self._cw.create_entity(etype, **kwargs)
File "/home/juj/src/fcubicweb/cubicweb/req.py", line 141, in create_entity
  return cls.cw_instantiate(self.execute, **kwargs)
File "/home/juj/src/fcubicweb/cubicweb/entity.py", line 290, in cw_instantiate
  created = execute(rql, kwargs).get_entity(0, 0)
File "/home/juj/src/fcubicweb/cubicweb/server/session.py", line 707, in execute
  rset = self._execute(self, rql, kwargs, build_descr)
File "/home/juj/src/fcubicweb/cubicweb/server/querier.py", line 710, in execute
  results = plan.execute()
File "/home/juj/src/fcubicweb/cubicweb/server/querier.py", line 201, in execute
  result = step.execute()
File "/home/juj/src/fcubicweb/cubicweb/server/ssplanner.py", line 635, in execute
  result = self.plan.insert_entity_defs()
File "/home/juj/src/fcubicweb/cubicweb/server/querier.py", line 552, in insert_entity_defs
  for edef in row])
File "/home/juj/src/fcubicweb/cubicweb/server/repository.py", line 1203, in glob_add_entity
  source.add_entity(session, entity)
File "/home/juj/src/fcubicweb/cubicweb/server/sources/native.py", line 574, in add_entity
  self.doexec(session, sql, attrs)
File "/home/juj/src/fcubicweb/cubicweb/server/sources/native.py", line 659, in doexec
  cursor.execute(str(query), args)
DataError: ERREUR:  séquence d'octets invalide pour l'encodage « UTF8 » : 0xc820
HINT:  Cette erreur peut aussi survenir si la séquence d'octets ne correspond pas
au jeu de caractères attendu par le serveur, le jeu étant contrôlé par
« client_encoding ».

Should I recreate my database ? What's the « client_encoding » configuration to change ?

prioritynormal
typebug
done in<not specified>
load0.000
load left0.000
closed by<not specified>
tagged by