From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: python-shell-send-region uses wrong encoding? Date: Wed, 30 Oct 2013 19:08:23 +0700 Message-ID: References: <20131029113044.GA28039@doriath.local> <5270AAF3.5040906@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1383134964 21503 80.91.229.3 (30 Oct 2013 12:09:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Oct 2013 12:09:24 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 30 13:09:29 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VbUaW-0005lu-4Q for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Oct 2013 13:09:28 +0100 Original-Received: from localhost ([::1]:52028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbUaV-0005aI-L8 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Oct 2013 08:09:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbUZW-0004g8-13 for help-gnu-emacs@gnu.org; Wed, 30 Oct 2013 08:08:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbUZU-0006Mw-NG for help-gnu-emacs@gnu.org; Wed, 30 Oct 2013 08:08:25 -0400 Original-Received: from mail-qc0-x22b.google.com ([2607:f8b0:400d:c01::22b]:38868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbUZU-0006Mp-Ix for help-gnu-emacs@gnu.org; Wed, 30 Oct 2013 08:08:24 -0400 Original-Received: by mail-qc0-f171.google.com with SMTP id i7so699162qcq.16 for ; Wed, 30 Oct 2013 05:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=M6aFsk8ppmy5YkPw1Arj3DUl4SaISCoGj8pjRHHvW/I=; b=acgGp0BPn+eu8txlk9zgORSR4kaqfCNH5TsIk1sYBDJWnHFhewj2qIZ2hMmukxP/j9 92yi3l7y9JDgyb/Ck/ZHYkQ+qc1SeJS5y3+XmXiITEItI9IhiYJEd9im+zXvELxY1SWB LprjjjuoACrymOcvnPNcSaiD7wRIlSUl8+xJKBjb3lPqbR/RK+6ow+1ld84b/d0Rgbqk wPbBog/HVjPgNe0RZ1ND2WZOc+7FNAUBTuacNtTt+4ektNtMZ189qrVeUdA5BXrpG8rI 6yae0PXsXIgoB6VJ0spvNL9qTynAUZP/rrLxCmDbKJjb+H4sYlfVp8XTMeQFkU+aYkkI IsUA== X-Received: by 10.49.127.179 with SMTP id nh19mr5968994qeb.1.1383134903817; Wed, 30 Oct 2013 05:08:23 -0700 (PDT) Original-Received: by 10.96.179.36 with HTTP; Wed, 30 Oct 2013 05:08:23 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: RT66_VFxigKcpXUZaknn-kYxxf8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94272 Archived-At: On Wed, Oct 30, 2013 at 6:37 PM, Stefan Monnier wrote: >> IIUC the second added line "-*- coding: utf-8 -*-\n" should not be needed, >> as that's the default at the Python side anyway. > > Based on the OP's experience, it seems this is not true. > Also, the doc I can find indicates that the default is ASCII (and was > latin-1 in the past, which is what the OP seems to be seeing). There is Python, and, on the other hand, there is Python. In some GNU/Linux distributions (e.g. Ubuntu), the default Python is version 2.x, whose default encoding is ASCII (and has been that way since at least 2.6). On the other hand, the current version of Python is 3.x, where a big Unicode revolution has happened and now the default encoding is UTF-8. Both of these Pythons recognize Emacs-style and vim-style encoding declarations, and in addition the UTF-8 byte order mark (which can be called Notepad-style encoding declaration).