Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'run-time': 0.05; '"c"': 0.07; 'cc:addr:python-list': 0.09; 'apache,': 0.09; 'subject:characters': 0.09; 'subject:script': 0.09; 'python': 0.10; 'encoding': 0.15; 'explicitly': 0.15; 'interpreter': 0.15; 'subject: \n ': 0.15; 'thu,': 0.15; 'differs': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'investigate': 0.16; 'subject:non': 0.16; 'subject:run': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'message- id:@mail.gmail.com': 0.27; 'environment': 0.29; 'run': 0.33; 'problem': 0.33; 'source': 0.33; 'choosing': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'environment.': 0.37; 'why': 0.39; 'subject:-': 0.39; 'matter': 0.63; 'chrisa': 0.84; 'initiates': 0.84; 'researching': 0.84; 'to:none': 0.91 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:content-transfer-encoding; bh=rTAjxN5AMT6yh0dyhHAisBwyIxQP4oqX+OUxB5w4Azk=; b=YBuw69rxrkpA9oeQqKbgzOLCjturWuofoQxms/F2OpNm20jKbL/SDm6Q4lWMU8KZ5+ P4fEfj+Pkp6+5xtQ7yAbHZVdJ9e3qta4OSDZpIQm2N/M5imfO/281OQwkye2dNbmtR5Q 5YSWL01gO4u1oyj5yI14Z/TfngzRJmr3pG82L/PboXf/3twG8t4h3AhFhrJKanu80CZi mS0nkbCPaMCy+dsmz9feE9cdV2IAbtNAjEv+ud2fQeSLiYNImWBAYMLZioZiyAhHBRGF pUUBJ2+OgSojj95+cVSxqNN6CdH3I8k9ljGil0m9ad3YGkvA0q2Hw4QgXhGPRo4kXi38 PXeQ== MIME-Version: 1.0 X-Received: by 10.107.134.146 with SMTP id q18mr4566446ioi.31.1440604677201; Wed, 26 Aug 2015 08:57:57 -0700 (PDT) In-Reply-To: <4fec8570-dfdf-4097-b6e6-c79fbd6e3022@googlegroups.com> References: <4fec8570-dfdf-4097-b6e6-c79fbd6e3022@googlegroups.com> Date: Thu, 27 Aug 2015 01:57:57 +1000 Subject: Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1440604680 news.xs4all.nl 23868 [2001:888:2000:d::a6]:58971 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95662 On Thu, Aug 27, 2015 at 1:02 AM, RAH wrote: > 7) Now, that source of the problem is known, I must investigate why my ru= n-time environment differs from the interpreter environment. I know it is t= he same machine, same Python 3.4.0. As the mod_wsgi module in Apache2 initi= ates Python for the run-time, I will look there around. > First place to look would be the environment. If os.environ["LANG"] has "C" when you run under Apache, that would be the explanation. But explicitly choosing the encoding is the best way for other reasons anyway, and it solves the problem, so researching this is merely a matter of curiosity. ChrisA