aboutsummaryrefslogtreecommitdiff
path: root/Tests/ttLib/tables/_n_a_m_e_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ttLib/tables/_n_a_m_e_test.py')
-rw-r--r--Tests/ttLib/tables/_n_a_m_e_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/ttLib/tables/_n_a_m_e_test.py b/Tests/ttLib/tables/_n_a_m_e_test.py
index bc4aab2f..11aeebae 100644
--- a/Tests/ttLib/tables/_n_a_m_e_test.py
+++ b/Tests/ttLib/tables/_n_a_m_e_test.py
@@ -432,6 +432,18 @@ class NameRecordTest(unittest.TestCase):
name = makeName(b'\xfe', 123, 1, 1, 0) # Mac Japanese
self.assertEqual(name.toUnicode(), unichr(0x2122))
+ def test_extended_mac_encodings_errors(self):
+ s = "汉仪彩云体简"
+ name = makeName(s.encode("x_mac_simp_chinese_ttx"), 123, 1, 25, 0)
+ # first check we round-trip with 'strict'
+ self.assertEqual(name.toUnicode(errors="strict"), s)
+
+ # append an incomplete invalid sequence and check that we handle
+ # errors with the requested error handler
+ name.string += b"\xba"
+ self.assertEqual(name.toUnicode(errors="backslashreplace"), s + "\\xba")
+ self.assertEqual(name.toUnicode(errors="replace"), s + "�")
+
def test_extended_unknown(self):
name = makeName(b'\xfe', 123, 10, 11, 12)
self.assertEqual(name.getEncoding(), "ascii")