I was wondering how can I change python's default encoding to UTF-8? When I print the default encoding in python it says "ascii", does it equals to UTF-8? or do I have to change it?
Asked
Active
Viewed 128 times
0
-
What is the *real* problem you are trying to solve? There are plenty of opportunities to avoid automatic encoding, but you need to tell us what your actual problem is here. – Martijn Pieters Jan 25 '14 at 22:14
-
Well, I'm writing a Java server-Python client project, and I have a problem while sending string over the socket. I asked in a previous question and they answered me that my python and java didn't have the same encoding, so the strings are getting some trash. – mapl93 Jan 25 '14 at 22:31
-
2You can explicitly encode unicode data to whatever codec you need. – Martijn Pieters Jan 25 '14 at 22:53
-
possible duplicate of [Changing default encoding of Python?](http://stackoverflow.com/questions/2276200/changing-default-encoding-of-python) – knitti Jan 26 '14 at 00:16
-
see http://stackoverflow.com/q/2276200/450517 BUT: you probably don't need it. just encode you output to utf-8 – knitti Jan 26 '14 at 00:16