Carets \^{} not rendered correctly
You can test if #1
is empty
\documentclass[12pt]{article}
\usepackage{fontspec}
\let\OldCircum\^
\def\^#1{%
\ifx\relax#1\relax
\textasciicircum
\else
\OldCircum#1%
\fi
}
\begin{document}
two carets (\texttt{\^{}}) produce a superscript (e.g.,
\texttt{ClO\^{}-1\^{}} renders ClO\textsuperscript{-1})
\^o
\end{document}
The issue applies to all accents in TU encoding. If no precomposed glyph is present then it falls back to using a combining character but if the base is empty this then combines with the previous character.
we should fix this in the base release but you can add a guard so that an empty base is detected and replaced by no-break space.
\documentclass[12pt]{article}
\usepackage{fontspec}
\makeatletter
\def\add@unicode@accent#1#2{%
\if\relax\detokenize{#2}\relax\string^^a0\else#2\fi\char#1\relax}
\makeatother
\begin{document}
two carets (\texttt{\^{}}) produce a superscript (e.g.,
\texttt{ClO\^{}-1\^{}} renders ClO\textsuperscript{-1})
\end{document}