diff --git a/anki/importing/noteimp.py b/anki/importing/noteimp.py
index d53f8a9ac..2b30558e3 100644
--- a/anki/importing/noteimp.py
+++ b/anki/importing/noteimp.py
@@ -123,7 +123,9 @@ class NoteImporter(Importer):
for c in range(len(n.fields)):
if not self.allowHTML:
n.fields[c] = cgi.escape(n.fields[c])
- n.fields[c] = n.fields[c].strip().replace("\n", "
")
+ n.fields[c] = n.fields[c].strip()
+ if not self.allowHTML:
+ n.fields[c] = n.fields[c].replace("\n", "
")
fld0 = n.fields[fld0idx]
csum = fieldChecksum(fld0)
# first field must exist