aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahiel@protonmail.ch>2015-12-24 11:14:49 +0100
committerRahiel Kasim <rahiel@protonmail.ch>2015-12-24 11:14:49 +0100
commit286b01ef0112ee5b8c41fad66ebd8e15002c3429 (patch)
tree091a8f44bc37c2dc7ccfe9aea674778fa8ccb9ff
parent37b09cc0d19c950f4b42b7df9dde7bf656de4e6b (diff)
fix UnicodeDecodeError
-rwxr-xr-xquran.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/quran.py b/quran.py
index 565baa8..f135fb3 100755
--- a/quran.py
+++ b/quran.py
@@ -14,7 +14,8 @@ def parse_quran_trans():
def process_verse(verse):
"""Add verse and replace for Arabic ligatures (salawat)"""
return (verse.strip()
- .replace("– peace and blessings be upon him", 'ﷺ‎'))
+ .replace("– peace and blessings be upon him", 'ﷺ‎')
+ .decode("utf-8"))
with open("en.ahmedraza", 'r') as f:
for line in f.readlines():
@@ -48,7 +49,7 @@ def parse_quran_tafsir():
def add_line(line, verse):
"""Add line and replace for Arabic ligatures (salawat)"""
- verse.append(line.strip().replace("(s)", 'ﷺ‎'))
+ verse.append(line.strip().replace("(s)", 'ﷺ‎').decode("utf-8"))
with open("Al_Jalalain_Eng.txt", 'r') as f:
for line in f.readlines():