[UPHPU] UTF8 Encoding

Dave Smith DavidSmith at byu.net
Fri Jun 17 16:17:03 MDT 2005

> My final question is now that I'm encrypting and encoding to base64 the
> body of the email, where should I perform the UTF8_ENCODE function?
> Before the encryption, right?

The answer is that you may not need to call utf8_encode() at all,
depending on the source of the message. Did you read the message from a
utf-8 encoded file? If so, don't encode it again. Just send it as is.
Remember that utf-8 is a stealthy little encoding that can stow away
aboard ascii text without modification. That's why it was invented (as
Joel so aptly explains in that article). So, if your emails are coming
from the content of a utf-8 encoded file, there is no need for
utf8_encode(). However, if the text you are sending is encoded in ascii or
something else, then you are going to have to convert it to utf-8 first.
Also, utf8_encode() expects the input string to be in iso-8859-1 (plain
old ascii English). So if it's not, the reults could be bunk.

So, answer this for us: What is the source of the text? And what is its

The other question this leads me to is: Why are you base-64 encoding it?
Do the recipients of the email know that it is base-64 encoded? Is this
maybe the problem?

Good luck! Hope to hear from you soon to help finish solving this one.


More information about the UPHPU mailing list