forked from openlp/openlp
Use the chosen encoding when importing from easyworship db.
This commit is contained in:
parent
8fbd431bed
commit
a02aca022a
@ -292,7 +292,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
raw_record = db_file.read(record_size)
|
raw_record = db_file.read(record_size)
|
||||||
self.fields = self.record_structure.unpack(raw_record)
|
self.fields = self.record_structure.unpack(raw_record)
|
||||||
self.set_defaults()
|
self.set_defaults()
|
||||||
self.title = self.get_field(fi_title).decode('unicode-escape')
|
self.title = self.get_field(fi_title).decode(self.encoding)
|
||||||
# Get remaining fields.
|
# Get remaining fields.
|
||||||
copy = self.get_field(fi_copy)
|
copy = self.get_field(fi_copy)
|
||||||
admin = self.get_field(fi_admin)
|
admin = self.get_field(fi_admin)
|
||||||
@ -300,16 +300,16 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
authors = self.get_field(fi_author)
|
authors = self.get_field(fi_author)
|
||||||
words = self.get_field(fi_words)
|
words = self.get_field(fi_words)
|
||||||
if copy:
|
if copy:
|
||||||
self.copyright = copy.decode('unicode-escape')
|
self.copyright = copy.decode(self.encoding)
|
||||||
if admin:
|
if admin:
|
||||||
if copy:
|
if copy:
|
||||||
self.copyright += ', '
|
self.copyright += ', '
|
||||||
self.copyright += translate('SongsPlugin.EasyWorshipSongImport',
|
self.copyright += translate('SongsPlugin.EasyWorshipSongImport',
|
||||||
'Administered by %s') % admin.decode('unicode-escape')
|
'Administered by %s') % admin.decode(self.encoding)
|
||||||
if ccli:
|
if ccli:
|
||||||
self.ccli_number = ccli.decode('unicode-escape')
|
self.ccli_number = ccli.decode(self.encoding)
|
||||||
if authors:
|
if authors:
|
||||||
authors = authors.decode('unicode-escape')
|
authors = authors.decode(self.encoding)
|
||||||
else:
|
else:
|
||||||
authors = ''
|
authors = ''
|
||||||
# Set the SongImport object members.
|
# Set the SongImport object members.
|
||||||
@ -497,7 +497,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
bytes = self.get_bytes(pos, length)
|
bytes = self.get_bytes(pos, length)
|
||||||
mask = '<' + str(length) + 's'
|
mask = '<' + str(length) + 's'
|
||||||
byte_str, = struct.unpack(mask, bytes)
|
byte_str, = struct.unpack(mask, bytes)
|
||||||
return byte_str.decode('unicode-escape').replace('\0', '').strip()
|
return byte_str.decode(self.encoding).replace('\0', '').strip()
|
||||||
|
|
||||||
def get_i16(self, pos):
|
def get_i16(self, pos):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user