Declare UTF-8 encoding in HTML <head>.
Handle bad input gracefully.