diff --git a/offlineimap.conf b/offlineimap.conf index 14d14df..3ea9817 100644 --- a/offlineimap.conf +++ b/offlineimap.conf @@ -765,9 +765,9 @@ remotehost = examplehost # This option stands in the [Repository RemoteExample] section. # -# Specify the remote user name. Must be unicode. +# Specify the remote user name. # -remoteuser = u"username" +remoteuser = username # This option stands in the [Repository RemoteExample] section. @@ -783,9 +783,7 @@ remoteuser = u"username" # mechanism, so consider using auth_mechanisms to prioritize PLAIN # or even make it the only mechanism to be tried. # -# Must be unicode type. -# -#remote_identity = u"authzuser" +#remote_identity = authzuser # This option stands in the [Repository RemoteExample] section. @@ -866,11 +864,14 @@ remoteuser = u"username" # OfflineIMAP starts when using a UI that supports this. # # 2. The remote password stored in this file with the remotepass -# option. Any '%' needs to be encoded as '%%'. Example: -#remotepass = u"myp%%ssword" # Password is: myp%ssword +# option. Save this file with the UTF-8 encoding if your server expect UTF-8 +# encoded password. # -# 3. The remote password stored as a single line in an external -# file, which is referenced by the remotefile option. Example: +# Any '%' needs to be encoded as '%%'. Example: +#remotepass = myp%%ssword # Real password is myp%ssword +# +# 3. The remote password stored as a single line in an external file, which is +# referenced by the remotefile option. Must be UTF-8 encoded. Example: #remotepassfile = ~/Password.IMAP.Account1 # # 4. With a preauth tunnel. With this method, you invoke an external @@ -1222,9 +1223,7 @@ type = Gmail # # Specify the Gmail user name. This is the only mandatory parameter. # -# Must be unicode type. -# -remoteuser = u"username@gmail.com" +remoteuser = username@gmail.com # This option stands in the [Repository GmailExample] section. diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 01a5583..bd06983 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -180,13 +180,15 @@ class IMAPRepository(BaseRepository): if self.config.has_option(self.getsection(), 'remoteusereval'): user = self.getconf('remoteusereval') - if user != None: - return localeval.eval(user).encode('UTF-8') + if user != None: + return localeval.eval(user).encode('UTF-8') if self.config.has_option(self.getsection(), 'remoteuser'): + # Assume the configuration file to be UTF-8 encoded so we must not + # encode this string again. user = self.getconf('remoteuser') - if user != None: - return user.encode('UTF-8') + if user != None: + return user try: netrcentry = netrc.netrc().authenticators(self.gethost()) @@ -355,7 +357,9 @@ class IMAPRepository(BaseRepository): # 2. read password from Repository 'remotepass' password = self.getconf('remotepass', None) if password != None: - return password.encode('UTF-8') + # Assume the configuration file to be UTF-8 encoded so we must not + # encode this string again. + return password # 3. read password from file specified in Repository 'remotepassfile' passfile = self.getconf('remotepassfile', None) if passfile != None: