php-i18n Digest 4 Feb 2004 04:44:48 -0000 Issue 213

Topics (messages 657 through 658):

Re: convert from UTF8 to EUC-JP
        657 by: Moriyoshi Koizumi

question about mail
        658 by: Ligaya Turmelle

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- On 2004/01/30, at 16:08, Ligaya Turmelle wrote:

OK I have a really basic question I hope. How do you have UTF8 data saved
to a MySQL 4.0 database and then extract it and put it back into UTF8? Do I
have to use the mb_convert_encoding($str, EUC_JP, UTF8) in PHP before the
insert and the reverse after the select? I'm using UTF8 on the web page but
the 4.0 version of MySQL doesn't support it ( Idiot me tested it in 4.1 not
thinking so the whole project is designed in UTF8).

I think you'll be better off using MySQL 4.1 (still in Alpha),
or the latest version of PostgreSQL, both of which natively supports UTF-8
character set.


As a side note: often it appears possible to forcefully use UTF-8 in a table that is
created to store strings of a character set different than UTF-8 because it actually
work without any error, but it would result in some weird behaviour when you use SQL
string manipulation functions / operators ("LIKE" / regex comparators) and FULLTEXT
indexes with such a mismatched setting.


In other words, you can use UTF-8 unless you are planning to use any of these features.
It's anyway discouraged though.


Moriyoshi
--- End Message ---
--- Begin Message ---
OK i am forcing the database to work in the UTF8 character set and am
sending the email in UTF8.  I beleive that I have all of the headers working
right but I have 1 small problem.  Outlook is not displaying the email in
the correct character set (UTF8).  How can I have Outlook automatically
switch over to the UTF8 character set.

I already have the header stating the charset as UTF8  or am I doing that
wrong?If I open the email and switch the encoding to UTF8 it views perfectly
fine.  So what am I doing wrong?

Code:
         // headers
        $headers = "From: $frName <$frEmail>\r\n";  // From
        $headers .= "Reply-To: $frReToName<$frReToEmail>\n";  // Reply to
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-type: text/plain; charset=utf8 \n";  //utf8
        $headers .= "Content-Transfer-Encoding: base64 \r\n";  // base 64
encoding


        // body of the message
        mb_language("uni");             // set to Unicode
        $message = chunk_split(base64_encode($tMess));          //encode and
split line into workable parts

        // display email
        echo "$add<br>";
        echo "$sub<BR>";
        echo "$headers<BR>";
        echo "$message";
        $decodedMessage = base64_decode($message);
        echo "$decodedMessage<BR>";

        // send email
        $sent = mail($add, $sub, $message, $headers);

--- End Message ---

Reply via email to