Is it possible to change an
environment variable, so that Python uses this coding automatically?
No.
Or pass a command-line argument when Emacs python-mode invokes the
Python interpreter?
No.
Or execute this line of Python in a startup script
which is invoked whenever a new Python
On 2008-04-19 03:09, [EMAIL PROTECTED] wrote:
Another poster pointed me to
sys.stdout = codecs.getwriter(UTF-8)(sys.stdout)
and this works great. All I want now is some reassurance that this is
the most appropriate way for me to achieve what I want (e.g. least
likely to break with future
I'd like to print out a unicode string.
I'm running Python inside Emacs, which understands utf-8, so I want to
force Python to send utf-8 to sys.stdout.
From what I've googled, I think I need to set my locale. I don't
understand how.
import locale
print locale.getlocale()
-- (None,None)
print
[EMAIL PROTECTED] writes:
From what I've googled, I think I need to set my locale. I don't
understand how.
import locale
print locale.getlocale()
-- (None,None)
print locale.getdefaultlocal()
-- ('en_GB','cp1252')
print locale.normalize('en_GB.utf-8')
-- en_GB.UTF8
On Apr 19, 12:51 am, Ben Finney wrote:
Just because the locale library knows the normalised name for it
doesn't mean it's available on your OS. Have you confirmed that your
OS (independent of Python) supports the locale you're trying to set?
No. How do I found out which locales my OS supports?
From what I've googled, I think I need to set my locale.
Not on this operating system. On Windows, you need to change
your console. If it is a cmd.exe-style console, use chcp.
For IDLE, changing the output encoding is not supported.
If you want to output into a file, use codecs.open.
If you
On Apr 18, 5:38 pm, [EMAIL PROTECTED] wrote:
I'd like to print out a unicode string.
I'm running Python inside Emacs, which understands utf-8, so I want to
force Python to send utf-8 to sys.stdout.
From what I've googled, I think I need to set my locale. I don't
understand how.
import
On Apr 18, 6:36 pm, 7stud [EMAIL PROTECTED] wrote:
On Apr 18, 5:38 pm, [EMAIL PROTECTED] wrote:
I'd like to print out a unicode string.
I'm running Python inside Emacs, which understands utf-8, so I want to
force Python to send utf-8 to sys.stdout.
From what I've googled, I think I
On Apr 19, 1:36 am, 7stud [EMAIL PROTECTED] wrote:
u_str = u'hell\u00F6 w\u00F6rld' #o's with umlauts
print u_str.encode('utf-8')
--output:--
hellö wörld
Maybe on your system. On my system, those same commands produce
hell\303\266 w\303\266rld
Those \303\266 symbols are single characters
[EMAIL PROTECTED] writes:
On Apr 19, 12:51 am, Ben Finney wrote:
Just because the locale library knows the normalised name for it
doesn't mean it's available on your OS. Have you confirmed that
your OS (independent of Python) supports the locale you're trying
to set?
No. How do I
On Apr 19, 1:14 am, Martin v. Löwis [EMAIL PROTECTED] wrote:
From what I've googled, I think I need to set my locale.
Not on this operating system. On Windows, you need to change
your console. If it is a cmd.exe-style console, use chcp.
For IDLE, changing the output encoding is not
On Apr 19, 1:53 am, Ben Finney wrote:
Damon Wischik writes:
Why does it matter what locales my OS supports, when all I want is
to set the encoding to be used for the output
Because the Python 'locale' module is all about using the OS's
(actually, the underlying C library's) locale support.
On Apr 19, 12:38 am, Damon Wischik wrote:
I'd like to print out a unicode string.
I'm running Python inside Emacs, which understands utf-8, so I want to
force Python to send utf-8 to sys.stdout.
Thank you everyone who was sent suggestions. Here is my solution (for
making Python output utf-8,
On Apr 18, 7:14 pm, Martin v. Löwis [EMAIL PROTECTED] wrote:
From what I've googled, I think I need to set my locale.
Not on this operating system. On Windows, you need to change
your console. If it is a cmd.exe-style console, use chcp.
For IDLE, changing the output encoding is not
14 matches
Mail list logo