(no subject)

Date: 2009-06-19 12:14 pm (UTC)
My terminal is iso-8859-1, so yes my first example worked.

My second example was misguided. It was meant to demonstrate that Python does sometimes obey the value of LANG. However, it turns out to be complaining about the output, not the input. In this case it looks like python is defaulting to a source encoding of iso-8859-1.

However, that only applies for programs executed via "-c"; the default for source read from a file seems to be ASCII (unless the file starts with a UTF-8 byte-order mark).
$ cat moose.py
#!/usr/bin/python
print u"møøse"
$ LANG=en_GB.ISO8859-1 python moose.py
  File "moose.py", line 2
SyntaxError: Non-ASCII character '\xf8' in file moose.py on line 2, but no
encoding declared; see http://www.python.org/peps/pep-0263.html for details
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

February 2025

S M T W T F S
      1
2345678
9101112131415
16171819202122
232425262728 

Most Popular Tags

Expand Cut Tags

No cut tags