From c8b275cdc3914ffd85859199fab7ba345613ee81 Mon Sep 17 00:00:00 2001 From: Joseph Ishac Date: Sun, 21 Feb 2021 22:31:49 -0500 Subject: [PATCH] Revert "Included charset detection" This reverts commit 62490ff1835b22941d1775d1d4bb98d042df026b. --- offlineimap/folder/Maildir.py | 15 +++------------ requirements.txt | 5 ----- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index 0c44b60..205feea 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -20,11 +20,9 @@ import socket import time import re import os -from pathlib import Path from sys import exc_info from threading import Lock from hashlib import md5 -import chardet from offlineimap import OfflineImapError, emailutil from .Base import BaseFolder @@ -258,18 +256,11 @@ class MaildirFolder(BaseFolder): def getmessage(self, uid): """Return the content of the message.""" - # TODO: Perhaps, force the encoding using config file filename = self.messagelist[uid]['filename'] filepath = os.path.join(self.getfullname(), filename) - # Open the file as binary and read it - file = Path(filepath) - blob = file.read_bytes() - # Detect the encoding - detection = chardet.detect(blob) - encoding = detection["encoding"] - # Read the file as text - retval = blob.decode(encoding) - + file = open(filepath, 'rt') + retval = file.read() + file.close() # TODO: WHY are we replacing \r\n with \n here? And why do we # read it as text? return retval.replace("\r\n", "\n") diff --git a/requirements.txt b/requirements.txt index 19d3fff..f543c51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,3 @@ gssapi[kerberos] portalocker[cygwin] rfc6555 distro - -imaplib2~=3.5 -urllib3~=1.25.9 -certifi~=2020.6.20 -chardet~=3.0.4 \ No newline at end of file