aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mbbmlib.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mbbmlib.py b/mbbmlib.py
index 8b8d585..0d000ef 100644
--- a/mbbmlib.py
+++ b/mbbmlib.py
@@ -6,6 +6,7 @@
# Title: Export Firefox Bookmarks to Html
# Purpose: Add favicons to bookmarks in exported html file
# History:
+# 2022-03-05 fix even more UTF-8 crap
# Usage:
# main command is export_bookmarks_to_html.
# Reference:
@@ -16,6 +17,7 @@
# https://stackoverflow.com/questions/43446353/converting-png-images-to-base64
# future: https://stackoverflow.com/questions/5119041/how-can-i-get-a-web-sites-favicon
# https://rosettacode.org/wiki/Strip_control_codes_and_extended_characters_from_a_string#Python
+# conn.text_factory to fix UTF-8 crap https://stackoverflow.com/questions/22751363/sqlite3-operationalerror-could-not-decode-to-utf-8-column/58891189#58891189
# Improve:
# add to pretty_print the option to select what format the output is in, like "title | url | icon" or similar.
# Documentation:
@@ -299,6 +301,7 @@ class Bookmark:
if debuglev > 4:
print("Using places file {0} and icons_file {1}".format(places_file,icons_file))
with sqlite3.connect(places_file) as conn:
+ conn.text_factory = lambda b: b.decode(errors = 'ignore')
# detect browser automatically
if browser == 'autodetect':
bgstack15