Fix an old bug in the Python BinHex code

This commit is contained in:
Elliot Nunn 2019-12-24 10:55:14 +08:00
parent d121980787
commit 87f98af7e1

View File

@ -164,12 +164,12 @@ class BinHex:
nl = len(name) nl = len(name)
if nl > 63: if nl > 63:
raise Error('Filename too long') raise Error('Filename too long')
d = bytes([nl]) + name.encode("latin-1") + b'\0' d = bytes([nl]) + name.encode("mac_roman") + b'\0'
tp, cr = finfo.Type, finfo.Creator tp, cr = finfo.Type, finfo.Creator
if isinstance(tp, str): if isinstance(tp, str):
tp = tp.encode("latin-1") tp = tp.encode("mac_roman")
if isinstance(cr, str): if isinstance(cr, str):
cr = cr.encode("latin-1") cr = cr.encode("mac_roman")
d2 = tp + cr d2 = tp + cr
# Force all structs to be packed with big-endian # Force all structs to be packed with big-endian