Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '"this': 0.03; 'encoding': 0.05; 'explicitly': 0.05; 'importing': 0.05; 'subsequent': 0.05; 'mysql,': 0.07; 'alias': 0.09; 'mind,': 0.09; 'postgres': 0.09; 'release.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bug': 0.12; 'jan': 0.12; 'stored': 0.12; 'deprecation': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'other)': 0.16; 'roy': 0.16; 'throw': 0.16; 'using,': 0.16; 'utf8': 0.16; 'subject:python': 0.16; 'followed': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'specify': 0.24; 'unicode': 0.24; 'url:dev': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'fixed': 0.29; '[1]': 0.29; 'am,': 0.29; '[2]': 0.30; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'ago': 0.33; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'returning': 0.36; 'surely': 0.36; 'doing': 0.36; 'next': 0.36; 'possible': 0.36; 'changing': 0.37; 'two': 0.37; 'project': 0.37; 'rather': 0.38; 'little': 0.38; 'does': 0.39; "couldn't": 0.39; 'itself': 0.39; 'though,': 0.39; 'according': 0.40; 'even': 0.60; 'subject:"': 0.60; 'url:5': 0.61; 'full': 0.61; 'range': 0.61; 'term': 0.63; 'choose': 0.64; 'lose': 0.68; 'smith': 0.68; 'default': 0.69; 'quality': 0.72; 'records': 0.73; 'long-term': 0.74; 'theoretical': 0.74; 'million': 0.74; 'favour': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=LKQd97wuVZlODjqP5fqyZXGZ0f9b0t2cEk07ZDxQ6E0=; b=pNTNPJPOwa1jSASW7VXS72tT/8jO5n2FAEtjZnB65zmSL6zP74aICnoCMESlhdAwso /TTe+J9cJXRX/lWt3lZn4KDbbPiCQ+7Jm11TmibgapXVLn/M7m8/UPRIQdAWZrBRmGce 3oJqHF1IRD08bNK16Xs/5pAark8m5De1iAyC+6HmqWKM3u4wY45BpBwMiGEzjahdRr48 j2O6QDThn8vSYFN8CEvSmhSUA4SIYaUUYE4K1bdtnna2CD6lBCPsDPpuP1yG/8TaC3GY hLEoyzndxVCSBalaNHoNcimfDKjhmp8oDgxRYcS2HZwrlZxynzX6s6/6XxQzGby/8Jr+ xfmQ== MIME-Version: 1.0 X-Received: by 10.66.102.39 with SMTP id fl7mr94675046pab.43.1388763134842; Fri, 03 Jan 2014 07:32:14 -0800 (PST) In-Reply-To: References: <52c1dc4c$0$2877$c3e8da3$76491128@news.astraweb.com> <52C1F5EC.3020808@stoneleaf.us> <52c29416$0$29987$c3e8da3$5496439d@news.astraweb.com> <52c6415c$0$29972$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 4 Jan 2014 02:32:14 +1100 Subject: Re: Blog "about python 3" From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388763458 news.xs4all.nl 2942 [2001:888:2000:d::a6]:54480 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63061 On Sat, Jan 4, 2014 at 1:57 AM, Roy Smith wrote: > I was doing a project a while ago importing 20-something million records > into a MySQL database. Little did I know that FOUR of those records > contained astral characters (which MySQL, at least the version I was > using, couldn't handle). > > My way of dealing with those records was to nuke them. Longer term we > ended up switching to Postgress. Look! Postgres means you don't lose data!! Seriously though, that's a much better long-term solution than destroying data. But MySQL does support the full Unicode range - just not in its "UTF8" type. You have to specify "UTF8MB4" - that is, "maximum bytes 4" rather than the default of 3. According to [1], the UTF8MB4 encoding is stored as UTF-16, and UTF8 is stored as UCS-2. And according to [2], it's even possible to explicitly choose the mindblowing behaviour of UCS-2 for a data type that calls itself "UTF8", so that a vague theoretical subsequent version of MySQL might be able to make "UTF8" mean UTF-8, and people can choose to use the other alias. To my mind, this is a bug with backward-compatibility concerns. That means it can't be fixed in a point release. Fine. But the behaviour change is "this used to throw an error, now it works". Surely that can be fixed in the next release. Or surely a version or two of deprecating "UTF8" in favour of the two "MB?" types (and never ever returning "UTF8" from any query), followed by a reintroduction of "UTF8" as an alias for MB4, and the deprecation of MB3. Or am I spoiled by the quality of Python (and other) version numbering, where I can (largely) depend on functionality not changing in point releases? ChrisA [1] http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html [2] http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb3.html