Praveen Singh Yadav
Praveen Singh Yadav

Reputation: 1861

ASCII as default encoding in python instead of utf-8

I only code in English but I have to deal with python unicode all the time. Sometimes its hard to remove unicode character from and dict. How can I change python default character encoding to ASCII???

Upvotes: 0

Views: 666

Answers (1)

jsbueno
jsbueno

Reputation: 110156

That would be the wrong thing to do. As in very wrong. To start with, it would only give you an UnicodeDecodeError instead of removing the characters. Learn proper encoding and decoding to/from unicode so that you can filter out tthe values using rules like errors="ignore"

You can't just ignore the characters taht are part of your data, just because you 'dislike" then. It is text, and in an itnerconected World, text is not composed of only 26 glyphs.

I'd suggest you get started by reading this document: http://www.joelonsoftware.com/articles/Unicode.html

Upvotes: 3

Related Questions