<< Back to Programming Forum   Search

Posts 1 - 1 of 1   
CLOT: Fix for non-ascii characters: 12/26/2012 20:14:09

Level 58

Warzone Creator
I just made a commit that should fix the problems that were coming up when non-ascii characters were used. If you're already working on a CLOT, you can merge my changes into yours by looking at this diff: https://github.com/FizzerWL/CLOT/commit/0d1fb446e1e2cf43aaa157d4ec5b968c70afa55a

The main change is that you have to use the unicode() function instead of str().

This fixes most of the problems. But you also need to be careful when converting lists into strings. For example, say you have a list of players called "players". If you just do unicode(players), you'll still get an error with non-ascii characters because Python tries to call str() for each player.

Instead, the best fix I could find is to call unicode() on every single player individually and join them together, like this: ', '.join([unicode(p) for p in players])
Posts 1 - 1 of 1