drime

French rhyme dictionary with web and CLI interface
git clone https://a3nm.net/git/drime/
Log | Files | Refs | README

commit 8389a003af377fa7a78387645956525d2f5a4d29
parent 5580d4c86d3f2a79936835cc6d816f4db7e96617
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 21 Sep 2013 10:21:17 +0200

fix œ and æ

Diffstat:
db_mysql.py | 4+++-
query.py | 4+++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/db_mysql.py b/db_mysql.py @@ -10,7 +10,9 @@ def run_query(r, v): user=config['user'], passwd=config['passwd'], db=config['db'], - cursorclass=MySQLdb.cursors.DictCursor) + cursorclass=MySQLdb.cursors.DictCursor, + charset='utf8', + use_unicode=True) cursor = db.cursor() cursor.execute(r.replace('?', '%s'), v) return cursor diff --git a/query.py b/query.py @@ -1,4 +1,5 @@ #!/usr/bin/python -O +# -*- coding: utf-8 -*- import sys import codecs @@ -41,6 +42,7 @@ def query(q, nsyl='', gender=True, page=0): else: phon = None word = ' '.join(word) + word = word.replace("œ".decode('utf-8'), "oe").replace("æ".decode('utf-8'), "ae") if word == '': word = None elide = False @@ -72,7 +74,7 @@ pass def decode_all(x): for k in x.keys(): if isinstance(x[k], str): - x[k] = x[k].decode('latin1') + x[k] = x[k].decode('utf8') def get_key(x): x['orig'] = decode_orig(x['orig'])