What is the best way to detect character set of an E-Mail message?

165 views Asked by At

I am currently developing a PHP script that connects to a remote IMAP server and fetches the body of a message, parses it and sends the data into a DB. The inbox contais 50000+ messages, some of them having US-ASCII and ISO-8859-1 encoding. The plain body of the message must be converted into UTF-8 encoding before submission to database.

What is the best way of detecting the character set of a message's plain text body?

0

There are 0 answers