+void TransManager::insert(string const & str, LyXText * text)
+{
+ // Go through the character encoding only if the current
+ // encoding (chset_->name()) matches the current font_norm
+ // (lyrxc->font_norm)
+
+ // Is false to speak about "only if" the current encoding will
+ // almost always be equal to font_norm.
+ pair<bool, int> enc = chset_.encodeString(str);
+ if (chset_.getName() != lyxrc.font_norm ||
+ !enc.first) {
+ // Could not find an encoding
+ InsetLatexAccent ins(str);
+ if (ins.canDisplay()) {
+ LCursor & cur = text->bv()->cursor();
+ lyx::cap::replaceSelection(cur);
+ cur.insert(new InsetLatexAccent(ins));
+ cur.posRight();
+ } else {
+ insertVerbatim(str, text);
+ }
+ return;
+ }
+ string const tmp(1, static_cast<char>(enc.second));
+ insertVerbatim(tmp, text);
+}