[pygame] Re: [pygame] Re: [pygame] problem with pygame.font and symbol °

2014-05-29 Thread Russell Jones
The other thing you might consider is adding as the first or second line

# -*- coding: utf8 -*-
or
# vim: set fileencoding=utf8 :
(see PEP 0263)

This is the encoding of the source file, in py2 specifying the specific set
of bytes will be in a string for a particular character, in py3 and in py2
unicode strings (u) specifying how those bytes should be translated to a
sequence of unicode code points in a string.

(I've not used python on windows much, so you might need to specify utf16le
or something else, mbcs?)

Russell


On 26 May 2014 07:52, Russell Jones russell.jo...@gmail.com wrote:


 On 14 May 2014 17:49, Dominik George n...@naturalnet.de wrote:

 str(angle)+°


 Or for Python 2.7 and 3.3+ compatibility
 (str(angle)+u°).encode(latin1)

 Note that in 2.7 adding the normal string to the unicode one produces a
 unicode string. It might seem better to use unicode(), but this doesn't
 exist in 3.
 Similarly u.join(['a', 'b', 'c'])

 Alternatively, use
 from __future__ import unicode_literals
 (str(angle)+°).encode(latin1)

 Russell



[pygame] Re: [pygame] Re: [pygame] problem with pygame.font and symbol °

2014-05-26 Thread Russell Jones
On 14 May 2014 17:49, Dominik George n...@naturalnet.de wrote:

 str(angle)+°


Or for Python 2.7 and 3.3+ compatibility
(str(angle)+u°).encode(latin1)

Note that in 2.7 adding the normal string to the unicode one produces a
unicode string. It might seem better to use unicode(), but this doesn't
exist in 3.
Similarly u.join(['a', 'b', 'c'])

Alternatively, use
from __future__ import unicode_literals
(str(angle)+°).encode(latin1)

Russell