lektor-tags
lektor-tags copied to clipboard
Break with unicode tag
I'm Korean. So I sometimes use Korean tag in post. but lektor-tags do not work fine with unicode tags
(techblog) [item4@item4-mbp item4.github.io]$ lektor server
* Project path: /Users/item4/Projects/item4.github.io/item4.github.io.lektorproject
* Output path: /Users/item4/Library/Caches/Lektor/builds/64ad49362b7f45d4919f47f92b714db9
Started source info update
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Finished source info update in 3.37 sec
Started build
Finished build in 1.15 sec
Started prune
Finished prune in 0.04 sec
Traceback (most recent call last):
File "/Users/item4/Projects/lektor/lektor/devserver.py", line 49, in build
builder.prune()
File "/Users/item4/Projects/lektor/lektor/builder.py", line 1062, in prune
for aft in build_state.iter_unreferenced_artifacts(all=all):
File "/Users/item4/Projects/lektor/lektor/builder.py", line 371, in iter_unreferenced_artifacts
and is_primary_source''', [artifact_name])
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
I have edited /Users/item4/Projects/lektor/lektor/builder.py and added a single line
con.text_factory = lambda x: unicode(x, 'utf-8', 'ignore')
after the following line
con = sqlite3.connect(self.buildstate_database_filename, timeout=10, check_same_thread=False) Ref Link : http://hakanu.net/sql/2015/08/25/sqlite-unicode-string-problem/
@haseenapa Have you considered contributing the fix to Lektor directly by sending a pull request?
Oops, just saw that @item4 actually submitted a fix for the issue. I'm guessing the issue could be closed?