Python codecs.utf_32_decode() Examples

The following are 30 code examples of codecs.utf_32_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 Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
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 #2
Source File: test_codecs.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
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 Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
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 #4
Source File: utf_32.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #5
Source File: utf_32.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #6
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_issue8941(self):
        # Issue #8941: insufficient result allocation when decoding into
        # surrogate pairs on UCS-2 builds.
        encoded_le = '\xff\xfe\x00\x00' + '\x00\x00\x01\x00' * 1024
        self.assertEqual(u'\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_le)[0])
        encoded_be = '\x00\x00\xfe\xff' + '\x00\x01\x00\x00' * 1024
        self.assertEqual(u'\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_be)[0]) 
Example #7
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_errors(self):
        self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode,
                          "\xff", "strict", True) 
Example #8
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_handlers(self):
        self.assertEqual((u'\ufffd', 1),
                         codecs.utf_32_decode('\x01', 'replace', True))
        self.assertEqual((u'', 1),
                         codecs.utf_32_decode('\x01', 'ignore', True)) 
Example #9
Source File: utf_32.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #10
Source File: utf_32.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #11
Source File: utf_32.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #12
Source File: utf_32.py    From android_universal with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #13
Source File: utf_32.py    From unity-python with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #14
Source File: utf_32.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #15
Source File: test_codecs.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_handlers(self):
        self.assertEqual((u'\ufffd', 1),
                         codecs.utf_32_decode('\x01', 'replace', True))
        self.assertEqual((u'', 1),
                         codecs.utf_32_decode('\x01', 'ignore', True)) 
Example #16
Source File: test_codecs.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_errors(self):
        self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode,
                          "\xff", "strict", True) 
Example #17
Source File: utf_32.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #18
Source File: utf_32.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #19
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_issue8941(self):
        # Issue #8941: insufficient result allocation when decoding into
        # surrogate pairs on UCS-2 builds.
        encoded_le = b'\xff\xfe\x00\x00' + b'\x00\x00\x01\x00' * 1024
        self.assertEqual('\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_le)[0])
        encoded_be = b'\x00\x00\xfe\xff' + b'\x00\x01\x00\x00' * 1024
        self.assertEqual('\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_be)[0]) 
Example #20
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_errors(self):
        self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode,
                          b"\xff", "strict", True) 
Example #21
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_handlers(self):
        self.assertEqual(('\ufffd', 1),
                         codecs.utf_32_decode(b'\x01', 'replace', True))
        self.assertEqual(('', 1),
                         codecs.utf_32_decode(b'\x01', 'ignore', True)) 
Example #22
Source File: utf_32.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #23
Source File: utf_32.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #24
Source File: utf_32.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #25
Source File: utf_32.py    From datafari with Apache License 2.0 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #26
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_issue8941(self):
        # Issue #8941: insufficient result allocation when decoding into
        # surrogate pairs on UCS-2 builds.
        encoded_le = '\xff\xfe\x00\x00' + '\x00\x00\x01\x00' * 1024
        self.assertEqual(u'\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_le)[0])
        encoded_be = '\x00\x00\xfe\xff' + '\x00\x01\x00\x00' * 1024
        self.assertEqual(u'\U00010000' * 1024,
                         codecs.utf_32_decode(encoded_be)[0]) 
Example #27
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_errors(self):
        self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode,
                          "\xff", "strict", True) 
Example #28
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_handlers(self):
        self.assertEqual((u'\ufffd', 1),
                         codecs.utf_32_decode('\x01', 'replace', True))
        self.assertEqual((u'', 1),
                         codecs.utf_32_decode('\x01', 'ignore', True)) 
Example #29
Source File: utf_32.py    From python2017 with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True) 
Example #30
Source File: utf_32.py    From ImageFusion with MIT License 5 votes vote down vote up
def decode(input, errors='strict'):
    return codecs.utf_32_decode(input, errors, True)