HTML form elements use the document's character encoding when you type. But when copying and pasting text from a word processor document saved in a different encoding (e.g. Windows 1252) you can get encoding mismatches that result in glitched characters.
This example attempts to convert pasted text to the document's specified encoding, which in this case is UTF-8.