Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UTF-8 Email with a UTF-8 URL

Status
Not open for further replies.

klwong

Programmer
Dec 7, 2001
14
0
0
HK
Hi all,

I have an email in utf-8 encoding. In the content of the email, I need
to send a link in which the filename is in utf-8 string...just like
this..

$content = "<a href=\" to file</a>";

however, the link can not be correctly passsed and it automatically
encodes it into %xx format. How to solve the problem?

I've tried urlencode($filename) and urldecode($filename) but cannot fix
the problem... Need Help~Thx
 
I recently had a similar problem with web pages, and it turned out that the problem was on the client side. The server wasn't sending the proper charset in the page header, so the client assumed the default charset, which was not UTF-8. For e-mail, I seem to recall that the default is US-ASCII, so I'm guessing it might be the same thing.

The first thing I'd try is adding a content-type charset header to the e-mail, assuming you don't already have one. Something like this at the top of the text might work:
Code:
$content = "MIME-Version: 1.0\r\n";
$content .= "Content-type: text/html; charset=utf-8\r\n";
$content .= "whatever body text";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top