From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ernest =?iso-8859-1?Q?Adrogu=E9?= Newsgroups: gmane.emacs.help Subject: python-shell-send-region uses wrong encoding? Date: Tue, 29 Oct 2013 12:30:44 +0100 Message-ID: <20131029113044.GA28039@doriath.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1383049403 17560 80.91.229.3 (29 Oct 2013 12:23:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Oct 2013 12:23:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 29 13:23:27 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 1Vb8KS-00035v-0s for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Oct 2013 13:23:24 +0100 Original-Received: from localhost ([::1]:46852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb8KR-0005W7-KD for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Oct 2013 08:23:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb7Vk-0002XS-MM for help-gnu-emacs@gnu.org; Tue, 29 Oct 2013 07:31:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb7Vd-0000aG-Uy for help-gnu-emacs@gnu.org; Tue, 29 Oct 2013 07:31:00 -0400 Original-Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:34623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb7Vd-0000Zv-OI for help-gnu-emacs@gnu.org; Tue, 29 Oct 2013 07:30:53 -0400 Original-Received: by mail-wg0-f47.google.com with SMTP id c11so8113199wgh.14 for ; Tue, 29 Oct 2013 04:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:content-transfer-encoding:user-agent; bh=hpwL4qlCHswx7qsCPtWr42KKdDiLsTHroyn4Db9iGmc=; b=n1pRJ6gr6OLySUkf81UDwhSR5RQmfxkKiSaS6xfJjMcaQikZppSEYT0fvqDt6KqsXq wEsKWzl18ZfGBFi1COO112A2ltQRyekg6YsVLp2dlI4XJZuJ5kwETmTLTG49n9bVNree POAaz3EUCj3zlQm7fckpJafeeSyztJPLVMG1zUXz3SKDaolP8Fx5OhvOXupC8PJHDp9d zE/PDMjgSpO8umKbIK4Mr4DSigko577Dvdx5dozHwm4HWeMc4ZkSL+uVj2WZhjCiuQ6p vv2+je6REfEgsuPK6sj1QPOF02DD51kpi9inygYr0Mk/d6vHLWk9aDEmZJYyfpZesw7a 397w== X-Received: by 10.180.185.101 with SMTP id fb5mr13089971wic.11.1383046252257; Tue, 29 Oct 2013 04:30:52 -0700 (PDT) Original-Received: from doriath (200.Red-83-58-146.dynamicIP.rima-tde.net. [83.58.146.200]) by mx.google.com with ESMTPSA id ev4sm3917750wib.7.2013.10.29.04.30.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 04:30:50 -0700 (PDT) Content-Disposition: inline X-Operating-System: GNU/Linux (Debian jessie/sid) User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22f X-Mailman-Approved-At: Tue, 29 Oct 2013 08:23:07 -0400 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:94239 Archived-At: Hi there, I have got a problem with python-shell-send-region. It seems to use a wrong encoding. For example, I have this file: $ cat /tmp/test.py #!/usr/bin/env python # -*- coding: utf-8 -*- =66rom __future__ import print_function a =3D 'W=F6rterbuch'.decode('utf8') b =3D u'W=F6rterbuch' print(repr(a)) print(repr(b)) $=20 When I open the file with Emacs and do python-shell-send-buffer (C-c C-c by default) the following lines appear in the shell buffer: u'W\xf6rterbuch' u'W\xf6rterbuch' This is the same output that I get when I run the script in a terminal. However, if I select the lines after 'from __future__ ...' until the end and do python-shell-send-region (C-c C-r) I get this output instead: u'W\xf6rterbuch' u'W\xc3\xb6rterbuch' The second line of output seems to indicate that the text was sent in a different encoding compared to python-shell-send-buffer. What is going on? Regards.