[thelist] UTF-8/FormMail/PHP headaches

Howard The Duck h.t.d at gmx.de
Wed May 22 15:22:01 CDT 2002

Well i'd do a regex check if any of your languages special chars are in
the posted text - if they are it's ISO-8859-1 else it's UTF-8
a crazy hack but it might work

if (!ereg ("[äüöÄÜÖ]", $postedtext))
	$postedtext = utf8_decode($postedtext);

adding an extra variable to check for is probably faster - you mentioned
it already. Another idea is to copy your formmail script, rename it
mailutf8.php, modify it as u need and use it on your new forms within
the utf-8 encoded pages. Or you can run a script through all your
webfiles that converts the files from ISO to utf-8 and change the
servers settings to serve utf-8 only. for unix systems the following 2
lines should work (example):

cd /var/www/
find . -name '*.html' | xargs recode iso-8859-1..utf-8


More information about the thelist mailing list