When typing in Spanish or French, I've long used the Compose key in X.  In my startup script (~/.xinit, ~/.xsession, or for me as a fluxbox user, ~/.fluxbox/startup) I have the following line

setxkbmap -option compose:caps

which turns my Caps key (which I never otherwise use) into a Compose key (here are ways to use other keys instead, if you prefer).

I can then type "{compose}{e}{'}" to get "&eacute;" or I type "{compose}{n}{~}" to get "&ntilde;" or "{compose}{c}{,}" to get "&ccedil;". Similarly I can use "{compose}{?}{?}" and "{compose}{!}{!}" to get "&iquest;" and "&iexcl;".  There are hundreds of these composable characters and many are intuitive enough that I can guess them if I don't know them cold.

Should work out of the box on Linux &amp; BSD systems running X, and work with pretty much every X application.