[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: python-shell-send-region uses wrong encoding?
From: |
Stefan Monnier |
Subject: |
Re: python-shell-send-region uses wrong encoding? |
Date: |
Tue, 29 Oct 2013 23:20:47 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> E.g. the patch below (which causes python-shell-send-string to tell
> Python that the file sent is using utf-8) should fix your problem (tho
> it's not a proper fix, since we shouldn't hardcode utf-8 here, but copy
> which ever -*- coding: -*- coding is in the file).
I installed a variant of that patch in Emacs's trunk, which should fix
the problem. The relevant part of the patch is quoted below, so you can
try it out,
Stefan
=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el 2013-10-07 18:51:26 +0000
+++ lisp/progmodes/python.el 2013-10-30 01:28:36 +0000
@@ -2045,7 +2051,9 @@
(concat (file-remote-p default-directory) "/tmp")
temporary-file-directory))
(temp-file-name (make-temp-file "py"))
+ (coding-system-for-write 'utf-8)
(file-name (or (buffer-file-name) temp-file-name)))
(with-temp-file temp-file-name
+ (insert "# -*- coding: utf-8 -*-\n")
(insert string)
(delete-trailing-whitespace))
RE: python-shell-send-region uses wrong encoding?, Drew Adams, 2013/10/29
Re: python-shell-send-region uses wrong encoding?, Stefan Monnier, 2013/10/29
Re: python-shell-send-region uses wrong encoding?, Ernest Adrogué, 2013/10/31
Re: python-shell-send-region uses wrong encoding?, Ernest Adrogué, 2013/10/31
Re: python-shell-send-region uses wrong encoding?, Stefan Monnier, 2013/10/31