How can I detect the encoding from POST data (using HTTP Content-Type response header) and then, if not UTF-8, convert it before processing/saving to database?Bonus question: If an encoding is not set in the content-type header, how could i detect it based on posted data?