3 ms·
I agree, I love Python but I've spent untold hours dealing with its unicode issues.
by ashrust 15y ago
I agree, I love Python but I've spent untold hours dealing with its unicode issues.
- codygman 15y agoEverything unencoded is unicode in 3 isn't it?
- lloeki 15y agoStrings are unicode. Bytes are encoded data. With Python 2 strings you have to be proactive about it and - always use u"" unless you know what you're doing - segregate non-unicode data to boundaries by decode()ing early and encode()ing late, or you're guaranteed to shoot yourself in the foot sooner or later but if you do it it's quite smooth sailing. Also, #/usr/bin/env python # -*- encoding: utf-8 -*- helps a lot. All that just brings you closer to Python 3 anyway and really helps when using 2to3.
- ashrust 15y agoAgreed, however I've run in to compatibility issues with 3 a few times and so resolved to stick w/ 2, deal with the text parsing issues myself, keep the libraries I like and leave the ops team alone.