Re:Why Python 3 Exists
by andreasvc on Thursday December 17, 2015 @04:05PM
(#10754547)
That's not the proper way. You should rarely need encode/decode if you make sure everything within Python is unicode. You ensure this by being specifying the encoding when getting data from external sources such as files, the network, or external libraries.
[ Parent
| on HN ]
Re:Why Python 3 Exists
by rcthompson on Thursday December 17, 2015 @04:11PM
(#10754578)
Of course I'm well aware this isn't the proper way to do it. I'm just saying it's the only way I've found that is successful with any degree of regularity. I've tried following the documentation as best I can, but like I said, half the time an encode ends up working where I thought I needed a decode or vice versa.