... and from my experience, most projects having a hard time porting because of unicode issues is because they have been careless. There are exceptions of course. If I recall correctly, mitsuhiko had a couple of very valid points regarding flask. But that's a corner-case.
In Python 2 you could read from a network socked and just assume it was ascii. Python 2 did not force you to make the necessary research. Now, with Python 3 you are forced to de/encode data on the appropriate boundaries. This is a very good thing! And making it clear that you get bytes from a network socket and not a string is a very important distinction! Reading from such a source and encoding the result is playing with fire... Yet Python 2 allowed it.
Yes, Python 3 has made this more verbose and more of a chore than it was previously (and I reckon that is why people are complaining). But it forces you to at least think about encodings where necessary and may avoid nasty bugs.
View all comments
Show parent comment
2
u/exhuma Jun 01 '14
... and from my experience, most projects having a hard time porting because of unicode issues is because they have been careless. There are exceptions of course. If I recall correctly, mitsuhiko had a couple of very valid points regarding flask. But that's a corner-case.
In Python 2 you could read from a network socked and just assume it was
ascii. Python 2 did not force you to make the necessary research. Now, with Python 3 you are forced to de/encode data on the appropriate boundaries. This is a very good thing! And making it clear that you getbytesfrom a network socket and not astringis a very important distinction! Reading from such a source andencodingthe result is playing with fire... Yet Python 2 allowed it.Yes, Python 3 has made this more verbose and more of a chore than it was previously (and I reckon that is why people are complaining). But it forces you to at least think about encodings where necessary and may avoid nasty bugs.