From 2ba8c41fec6f8abf86efdab3ae985e967f0a8bc6 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 11 Jul 2013 21:23:13 +0900 Subject: [PATCH] replace nbsp with standard space when stripping html fixes https://anki.tenderapp.com/discussions/ankidesktop/1952-duplicate-not-detected-on-paste --- anki/latex.py | 3 --- anki/utils.py | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/anki/latex.py b/anki/latex.py index 917cbcafd..062adfcb1 100644 --- a/anki/latex.py +++ b/anki/latex.py @@ -60,9 +60,6 @@ def _imgLink(col, latex, model): def _latexFromHtml(col, latex): "Convert entities and fix newlines." - # entitydefs defines nbsp as \xa0 instead of a standard space, so we - # replace it first - latex = latex.replace(" ", " ") latex = re.sub("|
", "\n", latex) latex = re.sub("<.+?>", "", latex) latex = stripHTML(latex) diff --git a/anki/utils.py b/anki/utils.py index 3315225fd..dbb9c91ae 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -146,6 +146,9 @@ def minimizeHTML(s): return s def entsToTxt(html): + # entitydefs defines nbsp as \xa0 instead of a standard space, so we + # replace it first + html = html.replace(" ", " ") def fixup(m): text = m.group(0) if text[:2] == "&#":