On 12/12/2013 14:34, wxjmfa...@gmail.com wrote:
Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit :
On Thu, Dec 12, 2013 at 8:17 PM,  <wxjmfa...@gmail.com> wrote:

Windows, Py2.(7), ascii. It is not a secret Python uses

ascii for the representation.



Actually no, it doesn't.



Python 2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit

(Intel)] on win32

s = "abcd\xa9"

print(s)

abcd©



The copyright symbol is not in ASCII. Are you suggesting that Python

uses a 7-bit internal representation of this data? Because a quick

squiz at the source code will prove that wrong. This is not ASCII.



sys.version
'2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]'
sys.stdout.encoding
'cp1252'
s = 'abc\xa9'
t = 'abc©'
s
'abc\xa9'
t
'abc\xa9'
print s, t, (s, t)
abc© abc© ('abc\xa9', 'abc\xa9')
def HumanStr(o):
        t = repr(o)
        newt = t.replace('\\xa9', '©')
        return newt

print s, t, (s, t), HumanStr((s, t))
abc© abc© ('abc\xa9', 'abc\xa9') ('abc©', 'abc©')


jmf

PS I do not insist on "sys.displayhook"

PS2 I can only congratulate this Turkish guy for
his understanding of Python


I understand that this Turkish guy will be added to the list here http://en.wikipedia.org/wiki/Turing_Award next year for his stunning contribution to the field of computer science. The year after he will win the award again for his outstanding contribution which prevents people from sending double spaced crap to this list.

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to