diff -r a82d7e028458 Doc/library/poplib.rst --- a/Doc/library/poplib.rst Mon Jun 16 19:26:56 2014 -0400 +++ b/Doc/library/poplib.rst Thu Jun 19 01:14:13 2014 +0200 @@ -194,6 +194,15 @@ the unique id for that message in the form ``'response mesgnum uid``, otherwise result is list ``(response, ['mesgnum uid', ...], octets)``. + +.. method:: POP3.utf8() + + Switch to UTF-8 mode if the server supports it. Returns the servers + response. Specified in :RFC:`6856`. + + .. versionadded:: 3.5 + + .. method:: POP3.stls(context=None) Start a TLS session on the active connection as specified in :rfc:`2595`. diff -r a82d7e028458 Lib/poplib.py --- a/Lib/poplib.py Mon Jun 16 19:26:56 2014 -0400 +++ b/Lib/poplib.py Thu Jun 19 01:14:13 2014 +0200 @@ -343,6 +343,13 @@ return self._longcmd('UIDL') + def utf8(self): + """Enter UTF-8 mode if supported by the server. Return capability + response or error message from server. Specified in RFC 6856. + """ + return self._shortcmd('UTF8') + + def capa(self): """Return server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') diff -r a82d7e028458 Lib/test/test_poplib.py --- a/Lib/test/test_poplib.py Mon Jun 16 19:26:56 2014 -0400 +++ b/Lib/test/test_poplib.py Thu Jun 19 01:14:13 2014 +0200 @@ -145,6 +145,9 @@ self.push(' '.join(_ln)) self.push('.') + def cmd_utf8(self, arg): + self.push('+OK I know RFC6856') + if SUPPORTS_SSL: def cmd_stls(self, arg): @@ -312,6 +315,11 @@ self.client.uidl() self.client.uidl('foo') + def test_utf8(self): + expected = b'+OK I know RFC6856' + result = self.client.utf8() + self.assertEqual(result, expected) + def test_capa(self): capa = self.client.capa() self.assertTrue('IMPLEMENTATION' in capa.keys())