News for hackers. Stuff that matters.
Re:Python For The Web by pyre on Tuesday October 18, 2011 @07:23PM (#3127751)
It also depends on what you need to do with the web. Perl is currently the best language for interacting with Unicode, for example. If you web needs include Unicode, you might have trouble with Ruby or Python, unless you're willing to accept half-ass, partial, or just plain wrong Unicode implementations.
Re:Python For The Web by ashrust on Tuesday October 18, 2011 @07:29PM (#3127781)
I agree, I love Python but I've spent untold hours dealing with its unicode issues.
Re:Python For The Web by codygman on Tuesday October 18, 2011 @10:45PM (#3128365)
Everything unencoded is unicode in 3 isn't it?
Re:Python For The Web by lloeki on Wednesday October 19, 2011 @08:44AM (#3129862)
Strings 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.

Re:Python For The Web by ashrust on Wednesday October 19, 2011 @12:50PM (#3130941)
Agreed, 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.
Re:Python For The Web by minikomi on Tuesday October 18, 2011 @08:12PM (#3127940)
As someone building websites using ruby & dealing with Japanese, I have to agree..

    incompatible character encodings: UTF-8 and ASCII-8BIT 
gets pretty tiresome! Using 1.9.2 at least you have .force_encoding ... feels pretty wrong but sometimes it's just needed to get the job done..
Re:Python For The Web by petercooper on Tuesday October 18, 2011 @08:10PM (#3127935)
Ruby's character encoding and Unicode support is pretty strong. I'm intrigued how you think it's half-ass, partial or just plain wrong (Really! If there's something really borked with it, it's in my interest to know :-)). Every string has full encoding support and it's baked right in to the language.
Re:Python For The Web by pyre on Tuesday October 18, 2011 @08:52PM (#3128062)
tchrist's OSCON Unicode talks:

http://98.245.80.27/tcpc/OSCON2011/index.html

Specifically the third talk:

http://98.245.80.27/tcpc/OSCON2011/gbu.html http://98.245.80.27/tcpc/OSCON2011/gbu.pdf

Excerpts:

  Its String functions like upcase or capitalize won’t even look at
  anything but ASCII. 

  It’s completely missing a whole lot of critical Unicode
  functionality:

    casemapping & -folding
    grapheme support
    normalization
    collation
    text segmentation, &c &c &c. 


  Every Ruby string carries around its encoding, instead of sanely
  unifying into Unicode internally like nearly everything else does.
Also:

  > baked right in to the language
is not synonymous with "intelligently implemented"

Note that I wasn't implying that "half-ass," "partial," and "just plain wrong" necessarily all apply to Python and/or Ruby's implementations. Some may apply to some areas while others may not, and really this extends outside of just Python and Ruby, but I'm trying to stay in context here.

Re:Python For The Web by petercooper on Tuesday October 18, 2011 @09:12PM (#3128117)
This is interesting stuff - thanks for sharing, I'll be checking it out. The upcase/downcase stuff definitely checks out so far :-)