So many new things to look into! Chris, I now will also investigate i18n.
Thank you. BIG SMILE... Always, Dwight www.3forliving.key.to (video playlist on YouTube) www.couragebooks.key.to (all my books on Amazon) On 8/10/15, 9:27 AM, "Chris Angelico" <ros...@gmail.com> wrote: >On Mon, Aug 10, 2015 at 3:41 AM, Michael Torrie <torr...@gmail.com> wrote: >> Web development is very a very hard problem, largely because it involves >> quite a few different domain-specific languages that you have to be >> proficient in... >> >> In this area, node.js is getting very popular. I don't care much for >> javascript but using it on the server as well as the web browser itself >> reduced the number of languages you have to know by one. > >There's another thing you absolutely have to know when you do web >development, and that's i18n. This is why I don't recommend Node.js >for server-side work - because Python's Unicode support is better than >JS's. Stick with Python (and avoid Python 2 on Windows) and you get >great Unicode support. Do anything in JavaScript/ECMAScript and you >get UTF-16 as the official representation. What's the length of the >string "Hello, world"? > >>>> len("Hello, world") >12 > >> "Hello, world".length >12 > >So far, so good. What if those weren't ASCII characters? > >>>> len("π·π΄π»π»πΎ, π πΎπ π»π³") >12 > >(That's Python 3. In Python 2, you'd need to put a u"" prefix on the >string, but it's otherwise the same, modulo the Windows narrow-build >issue.) > >> "π·π΄π»π»πΎ, π πΎπ π»π³".length >22 > >ECMAScript stipulates that strings are not codepoints, but UTF-16 code >units, so whenever you work with astral characters (which includes a >lot of emoticons, Chinese characters, and other symbols that your end >users *will* use), they'll get things wrong. The length of the string >counts astral characters twice; indexing/slicing can take half of a >character; any manipulation at all could corrupt your data. > >So, use Python for all your text processing. Life's better that way. > >ChrisA >-- >https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list