From: "Ernest Adrogué" <nfdisco@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: python-shell-send-region uses wrong encoding?
Date: Tue, 29 Oct 2013 17:34:26 +0100 [thread overview]
Message-ID: <20131029163426.GA29055@doriath.local> (raw)
In-Reply-To: <F1B1A3DD-AB17-4F51-91CA-057B82ED884E@Web.DE>
29-10-2013, 16:34 (+0100); Peter Dyballa escriu:
>
> Am 29.10.2013 um 15:55 schrieb Ernest Adrogué:
>
> > Here it's different, print(b) prints `Wörterbuch' (C-c C-r) and
> > `Wörterbuch' (C-c C-c).
>
> This obviously happens in an 8-bit environment. `Wörterbuch' is the
> sequence of octets that represent the ISO Latin-x (or ISO 8859) encoded
> word `Wörterbuch' in UTF-8 encoding. Here the "ö" is encoded as two
> octets: 0xC3 0xB6. The first one is in ISO 8859-15 the character "Ä" and
> the latter is in that encoding the character "¶".
>
> So it seems that one functions prints exclusively in UTF-8…
The "ö" character is stored in the file as 0xC3 0xB6. As you say, this is
the UTF-8 encoding for this character.
The Python interpreter interprets the 2-byte sequence correctly. This can
be seen in a number of ways: if I run the script in a terminal, or if I
paste or yank the line into Python shell buffer, or I do
python-shell-send-buffer, in all these cases the sequence is converted into
0xF6, which is the UTF-16 encoding for "ö" that Python uses internally, as
the output from repr() shows..
However, when the bytes are sent with python-shell-send-region, the
interpeter thinks that 0xC3 0xB6 are 2 characters, which is wrong. In light
of this, I would say that there is a bug in python-shell-send-region.
next prev parent reply other threads:[~2013-10-29 16:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 11:30 python-shell-send-region uses wrong encoding? Ernest Adrogué
2013-10-29 14:24 ` Drew Adams
2013-10-29 14:37 ` Ernest Adrogué
2013-10-29 16:00 ` Drew Adams
2013-10-29 16:54 ` Ernest Adrogué
2013-10-29 17:11 ` Eli Zaretskii
2013-10-29 14:26 ` Andreas Röhler
2013-10-29 14:55 ` Ernest Adrogué
2013-10-29 15:29 ` Andreas Röhler
2013-10-29 15:34 ` Peter Dyballa
2013-10-29 16:34 ` Ernest Adrogué [this message]
2013-10-29 17:15 ` Eli Zaretskii
2013-10-29 17:53 ` Ernest Adrogué
2013-10-29 19:10 ` Eli Zaretskii
2013-10-29 20:48 ` Ernest Adrogué
2013-10-29 18:07 ` Peter Dyballa
2013-10-29 20:37 ` Ernest Adrogué
2013-10-29 17:28 ` Stefan Monnier
2013-10-30 3:20 ` Stefan Monnier
2013-10-30 6:45 ` Andreas Röhler
2013-10-30 11:37 ` Stefan Monnier
2013-10-30 12:08 ` Yuri Khan
2013-10-30 12:45 ` Andreas Röhler
2013-10-31 14:30 ` Ernest Adrogué
2013-10-31 14:31 ` Ernest Adrogué
2013-10-31 17:54 ` Ernest Adrogué
2013-10-31 20:35 ` Stefan Monnier
2013-11-04 19:15 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131029163426.GA29055@doriath.local \
--to=nfdisco@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).