Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95647

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

Path csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; '-*-': 0.07; 'utf-8': 0.07; 'cc:addr:python-list': 0.09; 'coding:': 0.09; 'subject:characters': 0.09; 'subject:script': 0.09; 'python': 0.10; 'wed,': 0.15; 'subject: \n ': 0.15; 'echo': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'skip:> 20': 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; 'explicit': 0.22; 'installation': 0.23; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'message-id:@mail.gmail.com': 0.27; 'character': 0.29; 'code:': 0.29; 'common': 0.33; 'received:google.com': 0.35; 'sometimes': 0.35; 'should': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'difference': 0.38; 'subject:-': 0.39; 'where': 0.40; 'your': 0.60; "you'll": 0.61; 'more': 0.63; 'between': 0.65; '26,': 0.72; '--->': 0.84; 'chrisa': 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; bh=EFxpnwzOL/zvetbc5+lUwjxzSgHSkO1VWlScXLOtN+8=; b=r5LQAzcwW6tvImbhh/CFSXMckxx+7Goz0xpnZyOX3hAHsg6KF/qz7tSEaQWXG871jT 8nuFBSdO9u52Tgr7y/slgw4/JZQkq+2O8sPYym+eQfJJNYfjFeM2As9t9PYr1Ujy5MRw 1U2qcEKhNzTWM6TRMxJZCy07xkt6s/xbX+jx2ZOl1LDCmcEENWSdQQjRnYl4qWMjjg5l Tv/o46zWKLNTftpno/oIcpYEGsZunLvIAvX4e6CbvKxcZ0PrYyHTOeOilwFTco4JNK9q 3Hemn9KzN4Ab/HaT6xGxLDZPokYw9+X6EMqVWe847HlS3N5dvPG4w2W4HXIK0aCRlHcU IxzQ==
MIME-Version 1.0
X-Received by 10.107.3.149 with SMTP id e21mr2008007ioi.19.1440581082101; Wed, 26 Aug 2015 02:24:42 -0700 (PDT)
In-Reply-To <cf98e944-f5fd-4075-8155-98ad1cbf54ff@googlegroups.com>
References <c085c6af-31f6-480c-a9b4-90f46441fdd1@googlegroups.com> <mailman.34.1440538145.11709.python-list@python.org> <cf98e944-f5fd-4075-8155-98ad1cbf54ff@googlegroups.com>
Date Wed, 26 Aug 2015 19:24:42 +1000
Subject Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.41.1440581085.11709.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440581085 news.xs4all.nl 23755 [2001:888:2000:d::a6]:57796
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95647

Show key headers only | View raw


On Wed, Aug 26, 2015 at 7:12 PM, RAH <rene.heymans@gmail.com> wrote:
> By the way my whole installation is defaulted to UTF-8:
>
> HTML:        <head><meta charset="utf-8"></head>
> Javascript:  <script type="text/javascript" charset="UTF-8">
> PuTTY:       >Translation>Character set translation>Remote character set>UTF-8
> Python code: # -*- coding: utf-8 -*-
> Linux:       $ echo $LANG ---> en_US.UTF-8

Check that from actually inside your web script - os.environ["LANG"]
should be "en_US.UTF-8". If it isn't, then that may be where your
difference between web and interactive is, and so you'll need to be
more explicit about encodings.

It's common for background processes to have restricted environments,
sometimes with LANG=C or similar.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-25 14:19 -0700
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Chris Kaynor <ckaynor@zindagigames.com> - 2015-08-25 14:28 -0700
    Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 02:12 -0700
      Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Chris Angelico <rosuav@gmail.com> - 2015-08-26 19:24 +1000
        Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 07:24 -0700
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Chris Angelico <rosuav@gmail.com> - 2015-08-26 09:16 +1000
    Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 07:18 -0700
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run dieter <dieter@handshake.de> - 2015-08-26 07:51 +0200
    Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 07:20 -0700
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Pete Dowdell <contact@stridebird.com> - 2015-08-26 14:09 +0700
    Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 07:22 -0700
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 08:02 -0700
    Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Chris Angelico <rosuav@gmail.com> - 2015-08-27 01:57 +1000
      Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-26 12:23 -0700
        Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Chris Angelico <rosuav@gmail.com> - 2015-08-27 09:15 +1000
          Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run Marko Rauhamaa <marko@pacujo.net> - 2015-08-27 08:59 +0300
  Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run RAH <rene.heymans@gmail.com> - 2015-08-27 07:01 -0700

csiph-web