cms-dev / cms

Contest Management System
http://cms-dev.github.io/
GNU Affero General Public License v3.0
886 stars 360 forks source link

ContestExporter: handle correctly Unicode descriptions #43

Closed giomasce closed 11 years ago

giomasce commented 11 years ago

Although better than nothing, commit c5543df is just a hack. We need to check into more detail why Unicode encoded descriptions make ContestExporter fail and fix the real bug.

stefano-maggiolo commented 11 years ago

I might be wrong, but I think using codecs [http://docs.python.org/library/codecs.html] should solve the problem (if I got the problem right).

giomasce commented 11 years ago

Il 11/10/2012 16:33, Stefano Maggiolo ha scritto:

I might be wrong, but I think using codecs [http://docs.python.org/library/codecs.html] should solve the problem (if I got the problem right).

Probably so. Anyway, I'd like not to assume even that the description must be correctly encoded with some encoding. Description isn't meant to be actually used by CMS, is there only for human checks and is should never be the origin of any error.

Giovanni.

Giovanni Mascellani mascellani@poisson.phc.unipi.it Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org

giomasce commented 11 years ago

Apparently I wasn't understanding the obvious: the string is already guaranteed to be correct Unicode. I just have to encode it in the file with an encoding able to process any Unicode character.