From: Benjamin R. <ben...@ou...> - 2010-07-04 05:07:59
|
Ademir, I am glad it is working for you now. Just as a note, the unicode() function uses whatever encoding that is default on your system. Therefore, if it is possible for you to get inputs of strings in other encodings, then it is considered good practice to handle this at the point of string creation. Therefore, the rest of the code can simply assume that the strings are in the system's default encoding. Therefore, something like your solution would be better than changing the unicode() call in the suptitle() function. Ben Root On Sat, Jul 3, 2010 at 9:22 PM, Ademir Francisco da Silva < Ade...@it...> wrote: > Ryan ..., > > Very good ..., it works perfectly ... > > It's so easy but I didn't remember to use it ... > > In fact my problem is slightly more complicated than this because I have > used textName[ 2 ] instead of literal LotoFácil as I told you ( I know I > didn't say this before, my fault ), the correct code is ... > > fig.suptitle( textName[ 2 ], fontsize = self.fon[ 6 ][ 1 ], fontweight = > "extra bold", > > fontstyle = "italic", color = self.cor[ 608 ][ 1 ], > lod = True ) > > however, after your mention about *unicode string* you gave me a good idea > so I solved my problem this way ... > > fig.suptitle( unicode( self.textName[ 2 ], "cp1252" ), fontsize = self.fon[ > 6 ][ 1 ], fontweight = "extra bold", > > fontstyle = "italic", color = self.cor[ 608 ][ 1 ], > lod = True ) > > and everything works perfectly again. > > But I was thinking that the correct way is to fix it there in cbook.py, > anyway ... > > File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 1682, in > is_math_text > s = unicode(s) > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 5: > ordinal not in range(128) > > > Thank you very much for your prompt aid, > > > > Ademir Francisco da Silva > > > Em 03/07/2010 19:05, Ryan May escreveu: > > On Sat, Jul 3, 2010 at 4:12 PM, Ademir Francisco da Silva<Ade...@it...> <Ade...@it...> wrote: > > excerpt of may code is ... > fig.suptitle( "LotoFácil", fontsize = self.fon[ 6 ][ 1 ], fontweight = "extra bold", > fontstyle = "italic", color = self.cor[ 608 ][ 1 ], lod = True ) > > but I'm Brazilian and this is not correct for us. Help me please. > > Try using a python unicode string instead: > > fig.suptitle( u"LotoFácil", fontsize = self.fon[ 6 ][ 1 ], fontweight > = "extra bold", > fontstyle = "italic", color = self.cor[ 608 ][ > 1 ], lod = True ) > > That works for me here (though with the original, I just get missing > characters, not an error). > > Ryan > > > > > -- > Ademir Francisco da Silva > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |