Project

General

Profile

Anomalie #6080

Gestion de l’unicode et des exceptions

Added by Daniel Dehennin almost 10 years ago. Updated almost 10 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Category:
-
Start date:
09/23/2013
Due date:
09/27/2013
% Done:

100%

Spent time:
Distribution:
EOLE 2.4

Description

Le logger ne peut pas gérer correctement l’unicodisation des exceptions:

>>> python -c 'err = StandardError("« bidule »"); print unicode(err)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)
>>> python -c 'err = StandardError("« bidule »"); print unicode(err, "UTF-8")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, exceptions.StandardError found
>>> python -c 'err = StandardError("« bidule »"); print unicode(err.message, "UTF-8")'
« bidule »

On tourne en boucle et on réajoute des u'…' partout…

Associated revisions

Revision 43271ec6 (diff)
Added by Daniel Dehennin almost 10 years ago

Repassage en unicode

Le passage en unicode des objets « Exceptions() » ne fonctionne pas, il
ne faut donc passer que le message de l’exception :

python -c 'err = StandardError("« bidule »"); print unicode(err)'
Traceback (most recent call last):
File "&lt;string&gt;", line 1, in &lt;module&gt;
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)
python -c 'err = StandardError("« bidule »"); print unicode(err, "UTF-8")'
Traceback (most recent call last):
File "&lt;string&gt;", line 1, in &lt;module&gt;
TypeError: coercing to Unicode: need string or buffer, exceptions.StandardError found
python -c 'err = StandardError("« bidule »"); print unicode(err.message, "UTF-8")'
« bidule »
  • bin/CreoleCat (main): Passage du message d’exception au logger.
  • bin/CreoleGet (main): Idem.
  • bin/CreoleService (main): Idem.
  • creole/reconfigure.py: Passage de toutes les chaîne de caractère en
    unicode.
    Passage du message d’exception au logger.
  • creole/server.py: Idem.
  • creole/template.py: Idem.

Fixes: #6080 @1h30

History

#1 Updated by Daniel Dehennin almost 10 years ago

  • Description updated (diff)

#2 Updated by Daniel Dehennin almost 10 years ago

  • Status changed from Accepté to Résolu
  • % Done changed from 0 to 100

#3 Updated by Joël Cuissinat almost 10 years ago

  • Status changed from Résolu to Fermé

Also available in: Atom PDF