'{': "\\{"
'}': "\\}"
'_': "\\_"
'%': "\\%"
'#': "\\#"
'$': "\\$"
'&': "\\&"
'`': "\\textasciigrave{}"
'^': "\\textasciicircum{}"
'~': "\\textasciitilde{}"
'\\': "\\textbackslash{}"
'|': "\\textbar{}"
'<': "\\textless{}"
'>': "\\textgreater{}"
'[': '{[}'
']': '{]}'
Note that I'm not looking for accented letters, Unicode quotes and dashes etc. I'm assuming that people in the year 2021 are using an UTF-8-aware engine (and my corresponding HTML escape function similarly caters only to & < > " ').
TIA,
/Benct