How to print non-printable chars??

jmfauth wxjmfauth at gmail.com
Fri Aug 19 11:07:51 EDT 2011


On 18 août, 22:44, coldpizza <vri... at gmail.com> wrote:
>
>
> ...
>
> In a web/html environment or in broken ascii-only consoles like the
> one on windows ...

C:\Users\Jean-Michel>echo 'Cet œuf de Lætitia coûte un €uro'
'Cet œuf de Lætitia coûte un €uro'

C:\Users\Jean-Michel>c:\Python27\python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'Cet œuf de Lætitia coûte un €uro'
Cet œuf de Lætitia coûte un €uro
>>> import sys
>>> u = unicode('Cet œuf de Lætitia coûte un €uro', sys.stdin.encoding)
>>> print u.encode(sys.stdout.encoding)
Cet œuf de Lætitia coûte un €uro
>>>

C:\Users\Jean-Michel>c:\Python32\python
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Cet œuf de Lætitia coûte un €uro')
Cet œuf de Lætitia coûte un €uro
>>>

PS Cet œuf de Lætitia coûte un €uro ->
   This Lætitia's egg costs one €uro'

PS2 "ñ" does not require special attention.

PS3 To the original question: This not a *coding* issue, it is a
character *representation* question.

jmf



More information about the Python-list mailing list