diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index 1d132adcf..30bbefbbc 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -677,14 +677,14 @@ function ReaderDictionary:cleanSelection(text, is_sane) -- (example: pdf selection "qu’autrefois," will be cleaned to "autrefois") -- -- Replace no-break space with regular space - text = text:gsub("\xC2\xA0", ' ') -- U+00A0 no-break space + text = text:gsub("\u{00A0}", ' ') -- Trim any space at start or end text = text:gsub("^%s+", "") text = text:gsub("%s+$", "") if not is_sane then -- Replace extended quote (included in the general puncturation range) -- with plain ascii quote (for french words like "aujourd’hui") - text = text:gsub("\xE2\x80\x99", "'") -- U+2019 (right single quotation mark) + text = text:gsub("\u{2019}", "'") -- Right single quotation mark -- Strip punctuation characters around selection text = util.stripPunctuation(text) -- Strip some common english grammatical construct diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 87902e49a..b59d67a7f 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -386,7 +386,7 @@ local footerTextGeneratorMap = { book_title = function(footer) local doc_info = footer.ui.document:getProps() if doc_info and doc_info.title then - local title = doc_info.title:gsub(" ", "\xC2\xA0") -- replace space with no-break-space + local title = doc_info.title:gsub(" ", "\u{00A0}") -- replace space with no-break-space local title_widget = TextWidget:new{ text = title, max_width = footer._saved_screen_width * footer.settings.book_title_max_width_pct * (1/100), @@ -406,7 +406,7 @@ local footerTextGeneratorMap = { book_chapter = function(footer) local chapter_title = footer.ui.toc:getTocTitleByPage(footer.pageno) if chapter_title and chapter_title ~= "" then - chapter_title = chapter_title:gsub(" ", "\xC2\xA0") -- replace space with no-break-space + chapter_title = chapter_title:gsub(" ", "\u{00A0}") -- replace space with no-break-space local chapter_widget = TextWidget:new{ text = chapter_title, max_width = footer._saved_screen_width * footer.settings.book_chapter_max_width_pct * (1/100), @@ -2037,7 +2037,7 @@ function ReaderFooter:genAllFooterText() if self.settings.item_prefix == "compact_items" then -- remove whitespace from footer items if symbol_type is compact_items -- use a hair-space to avoid issues with RTL display - text = text:gsub("%s", "\xE2\x80\x8A") + text = text:gsub("%s", "\u{200A}") end -- if generator request a merge of this item, add it directly, -- i.e. no separator before and after the text then. diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 88f8658b7..3ba30f196 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -1649,7 +1649,7 @@ function ReaderHighlight:onUnhighlight(bookmark_item) if self.ui.paging then -- We can safely use page -- As we may have changed spaces and hyphens handling in the extracted -- text over the years, check text identities with them removed - local sel_text_cleaned = sel_text:gsub("[ -]", ""):gsub("\xC2\xAD", "") + local sel_text_cleaned = sel_text:gsub("[ -]", ""):gsub("\u{00AD}", "") for index = 1, #self.view.highlight.saved[page] do local highlight = self.view.highlight.saved[page][index] -- pos0 are tables and can't be compared directly, except when from @@ -1657,7 +1657,7 @@ function ReaderHighlight:onUnhighlight(bookmark_item) -- If bookmark_item provided, just check datetime if ( (datetime == nil and highlight.pos0 == sel_pos0) or (datetime ~= nil and highlight.datetime == datetime) ) then - if highlight.text:gsub("[ -]", ""):gsub("\xC2\xAD", "") == sel_text_cleaned then + if highlight.text:gsub("[ -]", ""):gsub("\u{00AD}", "") == sel_text_cleaned then idx = index break end diff --git a/frontend/apps/reader/modules/readertoc.lua b/frontend/apps/reader/modules/readertoc.lua index cd7a78e40..a3046851b 100644 --- a/frontend/apps/reader/modules/readertoc.lua +++ b/frontend/apps/reader/modules/readertoc.lua @@ -83,7 +83,7 @@ end function ReaderToc:cleanUpTocTitle(title, replace_empty) title = title:gsub("\13", "") if replace_empty and title:match("^%s*$") then - title = "\xE2\x80\x93" -- U+2013 En-Dash + title = "\u{2013}" -- En-Dash end return title end diff --git a/frontend/datetime.lua b/frontend/datetime.lua index 6477b2ab6..b7b44557a 100644 --- a/frontend/datetime.lua +++ b/frontend/datetime.lua @@ -150,7 +150,7 @@ function datetime.secondsToHClock(seconds, withoutSeconds, hmsFormat, withDays, if compact then return T(C_("Time", "%1s"), string.format("%d", seconds)) else - return T(C_("Time", "%1m\xE2\x80\x89%2s"), "0", string.format("%d", seconds)) + return T(C_("Time", "%1m\u{2009}%2s"), "0", string.format("%d", seconds)) -- use a thin space end else if compact then @@ -178,13 +178,13 @@ function datetime.secondsToHClock(seconds, withoutSeconds, hmsFormat, withDays, if hmsFormat then time_string = time_string:gsub("0(%d)", "%1") -- delete all leading "0"s - time_string = time_string:gsub(C_("Time", "d"), C_("Time", "d") .. "\xE2\x80\x89") -- add thin space after "d" - time_string = time_string:gsub(C_("Time", "h"), C_("Time", "h") .. "\xE2\x80\x89") -- add thin space after "h" + time_string = time_string:gsub(C_("Time", "d"), C_("Time", "d") .. "\u{2009}") -- add thin space after "d" + time_string = time_string:gsub(C_("Time", "h"), C_("Time", "h") .. "\u{2009}") -- add thin space after "h" if not withoutSeconds then - time_string = time_string:gsub(C_("Time", "m"), C_("Time", "m") .. "\xE2\x80\x89") .. C_("Time", "s") -- add thin space after "m" + time_string = time_string:gsub(C_("Time", "m"), C_("Time", "m") .. "\u{2009}") .. C_("Time", "s") -- add thin space after "m" end if compact then - time_string = time_string:gsub("\xE2\x80\x89", "\xE2\x80\x8A") -- replace thin space with hair space + time_string = time_string:gsub("\u{2009}", "\u{200A}") -- replace thin space with hair space end return time_string else diff --git a/frontend/document/koptinterface.lua b/frontend/document/koptinterface.lua index e5fef4ac8..133d93017 100644 --- a/frontend/document/koptinterface.lua +++ b/frontend/document/koptinterface.lua @@ -946,7 +946,7 @@ function KoptInterface:getTextFromBoxes(boxes, pos0, pos1) -- Previous line ended with a minus. -- Assume it's some hyphenation and discard it. line_text = line_text:sub(1, -2) - elseif line_text:sub(-2, -1) == "\xC2\xAD" then + elseif line_text:sub(-2, -1) == "\u{00AD}" then -- Previous line ended with a hyphen. -- Assume it's some hyphenation and discard it. line_text = line_text:sub(1, -3) diff --git a/frontend/ui/bidi.lua b/frontend/ui/bidi.lua index 42086a7c0..0d6800367 100644 --- a/frontend/ui/bidi.lua +++ b/frontend/ui/bidi.lua @@ -187,14 +187,14 @@ end -- which would be an issue and would need stripping. But as these -- Free fonts are only used as fallback fonts, and the invisible glyphs -- will have been found in the previous fonts, we don't need to. -local LRI = "\xE2\x81\xA6" -- U+2066 LRI / LEFT-TO-RIGHT ISOLATE -local RLI = "\xE2\x81\xA7" -- U+2067 RLI / RIGHT-TO-LEFT ISOLATE -local FSI = "\xE2\x81\xA8" -- U+2068 FSI / FIRST STRONG ISOLATE -local PDI = "\xE2\x81\xA9" -- U+2069 PDI / POP DIRECTIONAL ISOLATE +local LRI = "\u{2066}" -- LRI / LEFT-TO-RIGHT ISOLATE +local RLI = "\u{2067}" -- RLI / RIGHT-TO-LEFT ISOLATE +local FSI = "\u{2068}" -- FSI / FIRST STRONG ISOLATE +local PDI = "\u{2069}" -- PDI / POP DIRECTIONAL ISOLATE -- Not currently needed: --- local LRM = "\xE2\x80\x8E" -- U+200E LRM / LEFT-TO-RIGHT MARK --- local RLM = "\xE2\x80\x8F" -- U+200F RLM / RIGHT-TO-LEFT MARK +-- local LRM = "\u{200E}" -- LRM / LEFT-TO-RIGHT MARK +-- local RLM = "\u{200F}" -- RLM / RIGHT-TO-LEFT MARK function Bidi.ltr(text) return string.format("%s%s%s", LRI, text, PDI) diff --git a/frontend/ui/data/creoptions.lua b/frontend/ui/data/creoptions.lua index 57db4b937..18d281257 100644 --- a/frontend/ui/data/creoptions.lua +++ b/frontend/ui/data/creoptions.lua @@ -410,7 +410,7 @@ Note that your selected font size is not affected by this setting.]]), }, name_text_hold_callback = optionsutil.showValues, show_true_value_func = function(val) -- add "%" - return string.format("%d\xE2\x80\xAF%%", val) -- use Narrow No-Break space here + return string.format("%d\u{202F}%%", val) -- use Narrow No-Break space here end, }, } @@ -498,7 +498,7 @@ Note that your selected font size is not affected by this setting.]]), name_text_hold_callback = optionsutil.showValues, name_text_true_values = true, show_true_value_func = function(val) - return string.format("%d\xE2\x80\xAF%%, %d\xE2\x80\xAF%%", val[1], val[2]) -- use Narrow Now-Break space here + return string.format("%d\u{202F}%%, %d\u{202F}%%", val[1], val[2]) -- use Narrow Now-Break space here end, }, { @@ -537,7 +537,7 @@ Note that your selected font size is not affected by this setting.]]), name_text_hold_callback = optionsutil.showValues, name_text_true_values = true, show_true_value_func = function(val) - return string.format("%d\xE2\x80\xAF%%", val) -- use Narrow No-Break space here + return string.format("%d\u{202F}%%", val) -- use Narrow No-Break space here end, }, { diff --git a/frontend/ui/viewhtml.lua b/frontend/ui/viewhtml.lua index f43543146..4cc48a094 100644 --- a/frontend/ui/viewhtml.lua +++ b/frontend/ui/viewhtml.lua @@ -82,8 +82,8 @@ function ViewHtml:_viewSelectionHTML(document, selected_text, view, with_css_fil end if massage_html then -- Make some invisible chars visible - replace_in_html("\xC2\xA0", "␣") -- no break space: open box - replace_in_html("\xC2\xAD", "⋅") -- soft hyphen: dot operator (smaller than middle dot ·) + replace_in_html("\u{00A0}", "\u{2423}") -- no break space: open box + replace_in_html("\u{00AD}", "\u{22C5}") -- soft hyphen: dot operator (smaller than middle dot ·) -- Prettify inlined CSS (from
, put in an internal --