1

I've run into lots of bugs in Python due to the default ASCII encoding. I always have to remember to switch it to utf8

I wanted to know, is there any reason or benefit to a default ASCII encoding? It seems strictly worse than utf8, and causes annoying bugs. Am I missing something by always switching to utf8?

1
  • 3
    Because if you talk slow enough and loud enough in ASCII, every one will understand. :) Commented Sep 9, 2016 at 18:04

1 Answer 1

5

Because Python 2 Unicode was built (back in 1999-2000) before UTF-8 was ubiquitous. ASCII on the other hand was understood by almost all target platforms using 8-bit codecs.

If you look at the Wikipedia UTF-8 adoption graph, you'll see that UTF-8 didn't really rise to popularity until 2006:

UTF-8 growth graph from Wikipedia

Only with Python 3 was it possible to change this default; there implicit encoding and decoding is gone, and the default source code encoding has been changed to UTF-8 (the default for printing, file I/O and filesystem names is system dependent, as it is in Python 2).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.