I need to escape only characters above 127, such as french characters, that appear arbitrarily in english text. I don't want to do this manually and all the escapement formats escape everything, including HTML tags in the data.
There is no format code to escape characters 160 and above (the ISO-8859 foreign chars), only 128 through 159. You would have to manually escape such characters, using <fmtcp sandcall>. This code will escape $string's hit-bit characters:
<A NAME=cb hit>
<strfmt "%U" $hit> <!-- URL-encode to convert to hex -->
<substr $ret 1 -1> <!-- strip the leading `%' -->
<fmt "&#x%s;" $ret> <!-- print as HTML escape -->
</A>
<A NAME=main>
<fmtcp sandcall noesc "[\x80-\xFF]" "cb">
<sb>$string</sb>
</A>