Python codecs.utf_7_decode() Examples
The following are 30
code examples of codecs.utf_7_decode().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
codecs
, or try the search function
.
Example #1
Source File: test_codecs.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_errors(self): tests = [ ('a\xffb', u'a\ufffdb'), ('a+IK', u'a\ufffd'), ('a+IK-b', u'a\ufffdb'), ('a+IK,b', u'a\ufffdb'), ('a+IKx', u'a\u20ac\ufffd'), ('a+IKx-b', u'a\u20ac\ufffdb'), ('a+IKwgr', u'a\u20ac\ufffd'), ('a+IKwgr-b', u'a\u20ac\ufffdb'), ('a+IKwgr,', u'a\u20ac\ufffd'), ('a+IKwgr,-b', u'a\u20ac\ufffd-b'), ('a+IKwgrB', u'a\u20ac\u20ac\ufffd'), ('a+IKwgrB-b', u'a\u20ac\u20ac\ufffdb'), ('a+/,+IKw-b', u'a\ufffd\u20acb'), ('a+//,+IKw-b', u'a\ufffd\u20acb'), ('a+///,+IKw-b', u'a\uffff\ufffd\u20acb'), ('a+////,+IKw-b', u'a\uffff\ufffd\u20acb'), ] for raw, expected in tests: self.assertRaises(UnicodeDecodeError, codecs.utf_7_decode, raw, 'strict', True) self.assertEqual(raw.decode('utf-7', 'replace'), expected)
Example #2
Source File: test_codecs.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_decode_unicode(self): # Most decoders don't accept unicode input decoders = [ codecs.utf_7_decode, codecs.utf_8_decode, codecs.utf_16_le_decode, codecs.utf_16_be_decode, codecs.utf_16_ex_decode, codecs.utf_32_decode, codecs.utf_32_le_decode, codecs.utf_32_be_decode, codecs.utf_32_ex_decode, codecs.latin_1_decode, codecs.ascii_decode, codecs.charmap_decode, ] if hasattr(codecs, "mbcs_decode"): decoders.append(codecs.mbcs_decode) for decoder in decoders: self.assertRaises(TypeError, decoder, "xxx")
Example #3
Source File: test_codecs.py From oss-ftp with MIT License | 6 votes |
def test_errors(self): tests = [ ('a\xffb', u'a\ufffdb'), ('a+IK', u'a\ufffd'), ('a+IK-b', u'a\ufffdb'), ('a+IK,b', u'a\ufffdb'), ('a+IKx', u'a\u20ac\ufffd'), ('a+IKx-b', u'a\u20ac\ufffdb'), ('a+IKwgr', u'a\u20ac\ufffd'), ('a+IKwgr-b', u'a\u20ac\ufffdb'), ('a+IKwgr,', u'a\u20ac\ufffd'), ('a+IKwgr,-b', u'a\u20ac\ufffd-b'), ('a+IKwgrB', u'a\u20ac\u20ac\ufffd'), ('a+IKwgrB-b', u'a\u20ac\u20ac\ufffdb'), ('a+/,+IKw-b', u'a\ufffd\u20acb'), ('a+//,+IKw-b', u'a\ufffd\u20acb'), ('a+///,+IKw-b', u'a\uffff\ufffd\u20acb'), ('a+////,+IKw-b', u'a\uffff\ufffd\u20acb'), ] for raw, expected in tests: self.assertRaises(UnicodeDecodeError, codecs.utf_7_decode, raw, 'strict', True) self.assertEqual(raw.decode('utf-7', 'replace'), expected)
Example #4
Source File: test_codecs.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_decode_unicode(self): # Most decoders don't accept unicode input decoders = [ codecs.utf_7_decode, codecs.utf_8_decode, codecs.utf_16_le_decode, codecs.utf_16_be_decode, codecs.utf_16_ex_decode, codecs.utf_32_decode, codecs.utf_32_le_decode, codecs.utf_32_be_decode, codecs.utf_32_ex_decode, codecs.latin_1_decode, codecs.ascii_decode, codecs.charmap_decode, ] if hasattr(codecs, "mbcs_decode"): decoders.append(codecs.mbcs_decode) for decoder in decoders: self.assertRaises(TypeError, decoder, "xxx")
Example #5
Source File: test_codecs.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_decode_unicode(self): # Most decoders don't accept unicode input decoders = [ codecs.utf_7_decode, codecs.utf_8_decode, codecs.utf_16_le_decode, codecs.utf_16_be_decode, codecs.utf_16_ex_decode, codecs.utf_32_decode, codecs.utf_32_le_decode, codecs.utf_32_be_decode, codecs.utf_32_ex_decode, codecs.latin_1_decode, codecs.ascii_decode, codecs.charmap_decode, ] if hasattr(codecs, "mbcs_decode"): decoders.append(codecs.mbcs_decode) for decoder in decoders: self.assertRaises(TypeError, decoder, "xxx")
Example #6
Source File: utf_7.py From syntheticmass with Apache License 2.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #7
Source File: utf_7.py From ImageFusion with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #8
Source File: utf_7.py From python2017 with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #9
Source File: utf_7.py From datafari with Apache License 2.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #10
Source File: utf_7.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #11
Source File: utf_7.py From PhonePi_SampleServer with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #12
Source File: utf_7.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #13
Source File: test_codecs.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_errors(self): tests = [ (b'\xffb', '\ufffdb'), (b'a\xffb', 'a\ufffdb'), (b'a\xff\xffb', 'a\ufffd\ufffdb'), (b'a+IK', 'a\ufffd'), (b'a+IK-b', 'a\ufffdb'), (b'a+IK,b', 'a\ufffdb'), (b'a+IKx', 'a\u20ac\ufffd'), (b'a+IKx-b', 'a\u20ac\ufffdb'), (b'a+IKwgr', 'a\u20ac\ufffd'), (b'a+IKwgr-b', 'a\u20ac\ufffdb'), (b'a+IKwgr,', 'a\u20ac\ufffd'), (b'a+IKwgr,-b', 'a\u20ac\ufffd-b'), (b'a+IKwgrB', 'a\u20ac\u20ac\ufffd'), (b'a+IKwgrB-b', 'a\u20ac\u20ac\ufffdb'), (b'a+/,+IKw-b', 'a\ufffd\u20acb'), (b'a+//,+IKw-b', 'a\ufffd\u20acb'), (b'a+///,+IKw-b', 'a\uffff\ufffd\u20acb'), (b'a+////,+IKw-b', 'a\uffff\ufffd\u20acb'), (b'a+IKw-b\xff', 'a\u20acb\ufffd'), (b'a+IKw\xffb', 'a\u20ac\ufffdb'), ] for raw, expected in tests: with self.subTest(raw=raw): self.assertRaises(UnicodeDecodeError, codecs.utf_7_decode, raw, 'strict', True) self.assertEqual(raw.decode('utf-7', 'replace'), expected)
Example #14
Source File: utf_7.py From medicare-demo with Apache License 2.0 | 5 votes |
def _buffer_decode(self, input, errors, final): return codecs.utf_7_decode(input, self.errors)
Example #15
Source File: utf_7.py From python with Apache License 2.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #16
Source File: utf_7.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #17
Source File: utf_7.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #18
Source File: utf_7.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #19
Source File: utf_7.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #20
Source File: utf_7.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #21
Source File: utf_7.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #22
Source File: utf_7.py From unity-python with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #23
Source File: utf_7.py From android_universal with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #24
Source File: utf_7.py From canape with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #25
Source File: utf_7.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #26
Source File: utf_7.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #27
Source File: utf_7.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #28
Source File: utf_7.py From ironpython2 with Apache License 2.0 | 5 votes |
def decode(input, errors='strict'): return codecs.utf_7_decode(input, errors, True)
Example #29
Source File: test_codecs.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_errors(self): tests = [ ('\xe1b', u'\ufffdb'), ('a\xe1b', u'a\ufffdb'), ('a\xe1\xe1b', u'a\ufffd\ufffdb'), ('a+IK', u'a\ufffd'), ('a+IK-b', u'a\ufffdb'), ('a+IK,b', u'a\ufffdb'), ('a+IKx', u'a\u20ac\ufffd'), ('a+IKx-b', u'a\u20ac\ufffdb'), ('a+IKwgr', u'a\u20ac\ufffd'), ('a+IKwgr-b', u'a\u20ac\ufffdb'), ('a+IKwgr,', u'a\u20ac\ufffd'), ('a+IKwgr,-b', u'a\u20ac\ufffd-b'), ('a+IKwgrB', u'a\u20ac\u20ac\ufffd'), ('a+IKwgrB-b', u'a\u20ac\u20ac\ufffdb'), ('a+/,+IKw-b', u'a\ufffd\u20acb'), ('a+//,+IKw-b', u'a\ufffd\u20acb'), ('a+///,+IKw-b', u'a\uffff\ufffd\u20acb'), ('a+////,+IKw-b', u'a\uffff\ufffd\u20acb'), ('a+IKw-b\xe1', u'a\u20acb\ufffd'), ('a+IKw\xe1b', u'a\u20ac\ufffdb'), ] for raw, expected in tests: try: with self.assertRaises(UnicodeDecodeError): codecs.utf_7_decode(raw, 'strict', True) self.assertEqual(raw.decode('utf-7', 'replace'), expected) except: print 'raw=%r' % raw raise
Example #30
Source File: test_codecs.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_utf_7_decode(self): #sanity new_str, size = codecs.utf_7_decode("abc") self.assertEqual(new_str, u'abc') self.assertEqual(size, 3)