diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.js
index e0d46352c..d1113c708 100644
--- a/src/public/app/widgets/attribute_editor.js
+++ b/src/public/app/widgets/attribute_editor.js
@@ -311,7 +311,8 @@ export default class AttributeEditorWidget extends TabAwareWidget {
getPreprocessedData() {
const str = this.textEditor.getData()
- .replace(/]+href="(#[A-Za-z0-9/]*)"[^>]*>[^<]*<\/a>/g, "$1");
+ .replace(/]+href="(#[A-Za-z0-9/]*)"[^>]*>[^<]*<\/a>/g, "$1")
+ .replace(/ /g, " "); // otherwise .text() below outputs non-breaking space in unicode
return $("").html(str).text();
}