summaryrefslogtreecommitdiff
path: root/support/make4ht/filters/make4ht-entities-to-unicode.lua
diff options
context:
space:
mode:
Diffstat (limited to 'support/make4ht/filters/make4ht-entities-to-unicode.lua')
-rw-r--r--support/make4ht/filters/make4ht-entities-to-unicode.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/support/make4ht/filters/make4ht-entities-to-unicode.lua b/support/make4ht/filters/make4ht-entities-to-unicode.lua
index fb921a631a..4bf106a79f 100644
--- a/support/make4ht/filters/make4ht-entities-to-unicode.lua
+++ b/support/make4ht/filters/make4ht-entities-to-unicode.lua
@@ -6,10 +6,12 @@ local disabled = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;"}
return function(content)
local content = content:gsub("%&%#x([A-Fa-f0-9]+);", function(entity)
-- convert hexadecimal entity to Unicode
- local newchar = utfchar(tonumber(entity, 16))
+ local char_number = tonumber(entity, 16)
+ -- fix for non-breaking spaces, LO cannot open file when they are present as Unicode
+ if char_number == 160 then return "&#xA0;" end
+ local newchar = utfchar(char_number)
-- we don't want to break XML validity with forbidden characters
return disabled[newchar] or newchar
end)
- -- the non-breaking space character cause issues in the ODT opening
- return content:gsub(string.char(160), "&#xA0;")
+ return content
end