Exemple #1
0
    def test_decode(self):
        from hwp5.dataio import decode_utf16le_with_hypua

        expected = u'가나다'
        bytes = expected.encode('utf-16le')
        u = decode_utf16le_with_hypua(bytes)
        self.assertEquals(expected, u)
Exemple #2
0
    def test_decode(self):
        from hwp5.dataio import decode_utf16le_with_hypua

        expected = u'가나다'
        bytes = expected.encode('utf-16le')
        u = decode_utf16le_with_hypua(bytes)
        self.assertEquals(expected, u)
Exemple #3
0
 def parse_chunks(bytes):
     from hwp5.dataio import decode_utf16le_with_hypua
     size = len(bytes)
     idx = 0
     while idx < size:
         ctrlpos, ctrlpos_end = ControlChar.find(bytes, idx)
         if idx < ctrlpos:
             text = decode_utf16le_with_hypua(bytes[idx:ctrlpos])
             yield (idx / 2, ctrlpos / 2), text
         if ctrlpos < ctrlpos_end:
             cch = ControlChar.decode(bytes[ctrlpos:ctrlpos_end])
             yield (ctrlpos / 2, ctrlpos_end / 2), cch
         idx = ctrlpos_end
Exemple #4
0
 def test_decode(self):
     expected = u'가나다'
     bytes = expected.encode('utf-16le')
     u = decode_utf16le_with_hypua(bytes)
     self.assertEqual(expected, u)