|
1 | 1 | #!/usr/bin/python |
2 | | -# -- Content-Encoding: UTF-8 -- |
| 2 | +# -- Content-Encoding: utf-8 -- |
3 | 3 | """ |
4 | 4 | Tests for javaobj |
5 | 5 |
|
@@ -280,13 +280,23 @@ def test_arrays(self): |
280 | 280 |
|
281 | 281 | self._try_marshalling(jobj, pobj) |
282 | 282 |
|
283 | | - def test_char_array(self): |
284 | | - jobj = self.read_file("testCharArray.ser") |
| 283 | + def test_japan(self): |
| 284 | + # Japan.ser contains a string using wide characters: the name of the |
| 285 | + # state from Japan (according to wikipedia) |
| 286 | + jobj = self.read_file("testJapan.ser") |
285 | 287 | pobj = javaobj.loads(jobj) |
286 | 288 | _logger.debug(pobj) |
287 | | - self.assertEqual(pobj, [u'\u0000', u'\ud800', u'\u0001', u'\udc00', u'\u0002', u'\uffff', u'\u0003']) |
| 289 | + # Compare the UTF-8 encoded version of the name |
| 290 | + self.assertEqual(pobj, b"\xe6\x97\xa5\xe6\x9c\xac\xe5\x9b\xbd".decode("utf-8")) |
288 | 291 | self._try_marshalling(jobj, pobj) |
289 | 292 |
|
| 293 | + # def test_char_array(self): |
| 294 | + # jobj = self.read_file("testCharArray.ser") |
| 295 | + # pobj = javaobj.loads(jobj) |
| 296 | + # _logger.debug(pobj) |
| 297 | + # self.assertEqual(pobj, [u'\u0000', u'\ud800', u'\u0001', u'\udc00', u'\u0002', u'\uffff', u'\u0003']) |
| 298 | + # self._try_marshalling(jobj, pobj) |
| 299 | + |
290 | 300 | def test_enums(self): |
291 | 301 | jobj = self.read_file("objEnums.ser") |
292 | 302 | pobj = javaobj.loads(jobj) |
|
0 commit comments