Fixed a unicode encoding bug in the contact form.

Also removed duplicated code.