Re: [FX.php List] (mail) - problems with Æ - Ø - Å

Erik Andreas Cayré erik at cayre.dk
Tue May 1 18:36:42 MDT 2007


Heh!

Just saw your reply after sending mine, Chris!!!!

Two people, one mind...
/Erik

Den 02/05/2007 kl. 8.27 skrev Chris Bisgard:

> According to the manual, html_entity_decode() requires at minimum PHP
> version 4.3.0. Maybe you're running an older version than that on the
> problem server?
>
> Also, unhtmlentities() is a custom function that must be defined (or
> included) in your script. See the following from the php.net manual
> page for html_entity_decode() :
>
>
> // For users prior to PHP 4.3.0 you may do this:
> function unhtmlentities($string)
> {
>    // replace numeric entities
>    $string = preg_replace('~&#x([0-9a-f]+);~ei',
> 'chr(hexdec("\\1"))', $string);
>    $string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
>    // replace literal entities
>    $trans_tbl = get_html_translation_table(HTML_ENTITIES);
>    $trans_tbl = array_flip($trans_tbl);
>    return strtr($string, $trans_tbl);
> }
>
> $c = unhtmlentities($a);
>
>
> HTH,
> Chris Bisgard
>
>
>
> On 5/1/07, Baard Belsaas <fxphp at belsaas.no> wrote:
>> Hi Erik
>>
>> I try this in my site, but the unhtmlentities-code give me a Fatal  
>> error:
>> Call to undefined function: unhtmlentities() in
>> /Library/WebServer/Documents/mailtest.php on line 3
>>
>> The same happens on another server with the html_entity_decode,  
>> but not on
>> my local mac. Do I have to do some setup in the php to get this work?
>>
>>
>> /Baard
>>
>>
>> På 01-05-07 07:34, skrev "Erik Andreas Cayré" <erik at cayre.dk>:
>>
>> >
>> > Den 01/05/2007 kl. 6.15 skrev Baard Belsaas:
>> >
>> >> Hello, I have a send mail in my fx.php-site. I use the php-code "
>> >> mail()".
>> >> When there is a æ/Æ, ø/Ø or å/Å in the data from FileMaker, the
>> >> text in the
>> >> mail come with "wrong text". The letters print like this:
>> >> æ = &#230;
>> >> Æ = &#198;
>> >> ø = &#248;
>> >> Ø = &#216;
>> >> å = &#229;
>> >> Å = &#197;
>> >>
>> >> Someone out there nowes anything about this? Please...
>> >>
>> >>
>> >> Baard
>> >
>> > Hi Baard,
>> >
>> > The text from Filemaker is HTML-encoded by FX.php, ready to show  
>> on a
>> > webpage.
>> >
>> > Use html_entity_decode() on the text going into you email. It uses
>> > ISO-8859-1 by default, which is fine for most purposes.
>> >
>> > Example:
>> > $to = html_entity_decode($_SESSION['order']['customername'] . '  
>> <' .
>> > $_SESSION['order']['customeremail'] . '>');
>> > $subject = 'Your order ' . $_SESSION['order']['id'];
>> >
>> > // Convert HTMLencoding to ISO 8859-1
>> > $message = unhtmlentities($message);
>> >
>> >
>> > // headers
>> >
>> > $mailheaders = 'From: websitename <noreply at domain>' . '
>> > ' .'Reply-To: Customer Service <service at domain>' . '
>> > ' .'Bcc: secretrecipient <007 at otherdom>' . '
>> > ' . 'MIME-Version: 1.0' . '
>> > ' . 'Content-type: text/plain; charset=ISO-8859-1' . '
>> > ' . 'Content-Transfer-Encoding: quoted-printable' . '
>> > ' . 'X-Mailer: MyMagicMailer';
>> >
>> > // send mail receipt
>> >
>> > mail($to, $subject, wordwrap($message, 70), $mailheaders);
>> >
>> > Best regards
>> >
>> > ---
>> > Erik Andreas Cayré
>> > Spangsbjerg Møllevej 169
>> > 6705 Esbjerg Ø
>> >
>> > Privat Tel: 75150512
>> > Mobil: 40161183
>> >
>> > ---
>> > »Interesse kan skabe læring på en skala sammenlignet med frygt, som
>> > en nuklear eksplosion i forhold til en kineser.«
>> > --Stanley Kubrick
>> >
>> > »Kun p....sure mennesker kan ændre verden. Innovation skabes  
>> ikke af
>> > 'markedsanalyse', men af folk, der er afsindigt irriterede over
>> > tingenes tilstand «
>> > --Tom Peters
>> >
>> > »Hvis du ikke kan forklare det simpelt, forstår  du det ikke  
>> godt nok.«
>> > -- Albert Einstein
>> >
>> > »Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så  
>> have
>> > tid til at lave det om?«
>> > -- John Wooden, basketball coach
>> >
>> >
>> > _______________________________________________
>> > FX.php_List mailing list
>> > FX.php_List at mail.iviking.org
>> > http://www.iviking.org/mailman/listinfo/fx.php_list
>> >
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
6705 Esbjerg Ø

Privat Tel: 75150512
Mobil: 40161183

---
»Interesse kan skabe læring på en skala sammenlignet med frygt, som  
en nuklear eksplosion i forhold til en kineser.«
--Stanley Kubrick

»Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af  
'markedsanalyse', men af folk, der er afsindigt irriterede over  
tingenes tilstand «
--Tom Peters

»Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt nok.«
-- Albert Einstein

»Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så have  
tid til at lave det om?«
-- John Wooden, basketball coach




More information about the FX.php_List mailing list