From 3e623ba3ec0e1fc0491cdf6487b42c652d616ca6 Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Tue, 9 Oct 2007 23:12:31 +0000 Subject: [PATCH] Windows EOL sequence not converted correctly, encoding error. Caused file save to fail. Bug 1130. M idlelib/IOBinding.py M idlelib/NEWS.txt --- Lib/idlelib/IOBinding.py | 6 +++--- Lib/idlelib/NEWS.txt | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index cde2dae760..5a1599515a 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -242,7 +242,6 @@ class IOBinding: eol = r"(\r\n)|\n|\r" # \r\n (Windows), \n (UNIX), or \r (Mac) eol_re = re.compile(eol) - eol_convention = os.linesep # Default def loadfile(self, filename): try: @@ -389,9 +388,10 @@ class IOBinding: def writefile(self, filename): self.fixlastline() - chars = self.encode(self.text.get("1.0", "end-1c")) + text = self.text.get("1.0", "end-1c") if self.eol_convention != "\n": - chars = chars.replace("\n", self.eol_convention) + text = text.replace("\n", self.eol_convention) + chars = self.encode(self.text.get("1.0", "end-1c")) try: f = open(filename, "wb") f.write(chars) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index f0dee79188..460b5b51e0 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,3 +1,12 @@ +What's New in IDLE 3.0a2? +========================= + +*Release date: XX-XXX-2007* + +- Windows EOL sequence not converted correctly, encoding error. + Caused file save to fail. Bug 1130. + + What's New in IDLE 3.0a1? ========================= @@ -19,7 +28,7 @@ What's New in IDLE 3.0a1? What's New in IDLE 2.6a1? ========================= -*Release date: XX-XXX-200X* UNRELEASED +*Release date: XX-XXX-200X* UNRELEASED, but merged into 3.0a1 - Corrected some bugs in AutoComplete. Also, Page Up/Down in ACW implemented; mouse and cursor selection in ACWindow implemented; double Tab inserts -- 2.40.0