mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
deploy-ng: be lenient when processing DLLs with invalid codepage
This commit is contained in:
parent
ef69e8935f
commit
5322811e08
@ -112,11 +112,18 @@ class DataResource(object):
|
|||||||
self.data = None
|
self.data = None
|
||||||
self.code_page = 0
|
self.code_page = 0
|
||||||
|
|
||||||
def get_data(self):
|
@property
|
||||||
if self.code_page:
|
def encoding(self):
|
||||||
return self.data.encode('cp%d' % self.code_page)
|
if self.code_page == 0:
|
||||||
|
return 'ascii'
|
||||||
else:
|
else:
|
||||||
return self.data
|
return 'cp%d' % (self.code_page)
|
||||||
|
|
||||||
|
def get_data(self):
|
||||||
|
return self.data
|
||||||
|
|
||||||
|
def get_text(self, errors='strict'):
|
||||||
|
return self.data.decode(self.encoding, errors)
|
||||||
|
|
||||||
|
|
||||||
class IconGroupResource(object):
|
class IconGroupResource(object):
|
||||||
@ -479,10 +486,6 @@ class ResourceTable(object):
|
|||||||
entry = IconGroupResource()
|
entry = IconGroupResource()
|
||||||
entry.unpack_from(data)
|
entry.unpack_from(data)
|
||||||
else:
|
else:
|
||||||
if code_page != 0:
|
|
||||||
# Decode the data using the provided code page.
|
|
||||||
data = data.decode("cp%d" % code_page)
|
|
||||||
|
|
||||||
entry = DataResource()
|
entry = DataResource()
|
||||||
entry.data = data
|
entry.data = data
|
||||||
entry.code_page = code_page
|
entry.code_page = code_page
|
||||||
|
Loading…
x
Reference in New Issue
Block a user