Fix songshowplus encoding issue.

This commit is contained in:
Tomas Groth 2017-05-30 22:05:18 +02:00
parent 533bef159a
commit 4a3e4e1ad4
2 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,6 @@
The :mod:`songshowplus` module provides the functionality for importing SongShow Plus songs into the OpenLP
database.
"""
import chardet
import os
import logging
import re
@ -226,6 +225,7 @@ class SongShowPlusImport(SongImport):
def decode(self, data):
try:
return str(data, chardet.detect(data)['encoding'])
# Don't question this, it works...
return data.decode('utf-8').encode('cp1251').decode('cp1251')
except:
return str(data, retrieve_windows_encoding())
return data.decode(retrieve_windows_encoding())

View File

@ -15,7 +15,7 @@
"v1"
],
[
"Did we in our own strength confide, our striving would be losing;\r\nWere not the right Man on our side, the Man of God’s own choosing:\r\nDost ask who that may be? Christ Jesus, it is He;\r\nLord Sabaoth, His Name, from age to age the same,\r\nAnd He must win the battle.\r\n",
"Did we in our own strength confide, our striving would be losing;\r\nWere not the right Man on our side, the Man of Gods own choosing:\r\nDost ask who that may be? Christ Jesus, it is He;\r\nLord Sabaoth, His Name, from age to age the same,\r\nAnd He must win the battle.\r\n",
"v2"
],
[
@ -23,7 +23,7 @@
"v3"
],
[
"That word above all earthly powers, no thanks to them, abideth;\r\nThe Spirit and the gifts are ours through Him Who with us sideth:\r\nLet goods and kindred go, this mortal life also;\r\nThe body they may kill: God’s truth abideth still,\r\nHis kingdom is forever.\r\n",
"That word above all earthly powers, no thanks to them, abideth;\r\nThe Spirit and the gifts are ours through Him Who with us sideth:\r\nLet goods and kindred go, this mortal life also;\r\nThe body they may kill: Gods truth abideth still,\r\nHis kingdom is forever.\r\n",
"v4"
]
]