aboutsummaryrefslogtreecommitdiff
path: root/mbbmlib.py
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-03-05 21:28:05 -0500
committerB. Stack <bgstack15@gmail.com>2022-03-05 21:28:05 -0500
commitcd17ac14d27b94b27f881a3b4a73e4e985d984b8 (patch)
tree0432bc6db3c58b7e67e65508de2c25402b97b7c9 /mbbmlib.py
parentadd 15-column support for LibreWolf (diff)
downloadmbbmlib-cd17ac14d27b94b27f881a3b4a73e4e985d984b8.tar.gz
mbbmlib-cd17ac14d27b94b27f881a3b4a73e4e985d984b8.tar.bz2
mbbmlib-cd17ac14d27b94b27f881a3b4a73e4e985d984b8.zip
fix more UTF-8 errors
Diffstat (limited to 'mbbmlib.py')
-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