[FX.php List] The Euro sign (€ or € ) in email messages

Erik Andreas Cayré erik at cayre.dk
Sat May 5 04:52:49 MDT 2007


Den 05/05/2007 kl. 11.34 skrev Gjermund Gusland Thorsen:

> I'm not sure if this does exactly the same as you, but I changed the
> principle a bit,
> I hope it is more readable...
>
> function price($dkk, $euro=7.4571) {
> 	$curr = array(
> 		' (€ ' . number_format ($dkk / $euro, 2, ',', '.') .  
> ')',
> 		'da' => 'DKK ',
> 		''
> 	);
> 	return $curr[$_SESSION['lang']];
> }

It doesn't, but that's ok. My price function already works just fine  
as it is (even though it may not be very readable...)
The problem remains: the Euro character is fine on the web receipt,  
but not in the email receipt...

> On 5/5/07, Erik Andreas Cayré <erik at cayre.dk> wrote:
>>
>> Den 04/05/2007 kl. 21.21 skrev Dale Bengston:
>>
>> > Hi Erik,
>> >
>> > Sometimes these things can be typeface-specific.
>>
>> That's right, although in my testcase the Euro sign is present in the
>> typeface used by my mail client.
>>
>> > Also, what does the character look like in $message, before you
>> > decode it? Is it &#xAC; before that?
>>
>> I'm putting it in there myself with this:
>>
>> // Return price with appended EURO equivalent, if page viewed in non-
>> danish language
>>         function price($dkk, $euro=7.4571) {
>>                 $price = (($_SESSION['lang'] == 'da') ? 'kr.&nbsp;' :
>> 'DKK&nbsp;') . $dkk . ',-' . (($_SESSION['lang'] != 'da') ?
>> ' (&#x20AC;&nbsp;' . number_format ($dkk / $euro, 2, ',', '.') .
>> ')' : '');
>>                 return $price;
>>         }
>>
>> /Erik
>>
>> > Dale
>> >
>> > On May 4, 2007, at 2:00 PM, Erik Andreas Cayré wrote:
>> >
>> >> Hi all,
>> >>
>> >> After the discussion som days ago regarding (un)encoding text, I
>> >> decided to finally try to solve a problem which has been waiting
>> >> for my attention.
>> >>
>> >> At the end of a completed purchase, the customer is presented with
>> >> a web page receipt, and the script generating it also sends an
>> >> email receipt to the customer.
>> >>
>> >> Reading the docs for html_entity_decode() I decided to try the
>> >> charset ISO-8859-15, since it supposedly contains the Euro sign €
>> >> (in case any of you don't know, it's the currency symbol for the
>> >> relatively new common currency now in use in most European  
>> countries)
>> >>
>> >> Snippets of my code:
>> >> $message2 = html_entity_decode($message, ENT_COMPAT,  
>> 'ISO-8859-15');
>> >>
>> >> $mailheaders2 = 'From: dagkort.dk <php at dagkort.dk>' . '
>> >> ' .'Reply-To: dagkort.dk <service at dagkort.dk>' . '
>> >> ' . 'MIME-Version: 1.0' . '
>> >> ' . 'Content-type: text/plain; charset=ISO-8859-15' . '
>> >> ' . 'Content-Transfer-Encoding: quoted-printable' . '
>> >> ' . 'X-Mailer: PHP/' . phpversion();
>> >>
>> >> // send testmail receipt
>> >>
>> >>      mail('erik.cayre at dagkort.dk', $subject, wordwrap 
>> ($message2, 70),
>> >> $mailheaders2);
>> >>
>> >> The messages sent using the above do not correctly show the Euro
>> >> sign.
>> >> Instead I get this '¬' (don't know the name of that character, but
>> >> it's &#xAC; when HTML encoded)
>> >>
>> >> Does anyone have a solution, or a clue?
>> >>
>> >>
>> >> ---
>> >> Erik Andreas Cayré
>> >> Spangsbjerg Møllevej 169
>> >> DK-6705 Esbjerg Ø
>> >>
>> >> Home Tel: +45 75150512
>> >> Mobile: +45 40161183
>> >>
>> >> »Interest can produce learning on a scale compared to fear as a
>> >> nuclear explosion to a firecracker.«
>> >> --Stanley Kubrick
>> >>
>> >> »If you can't explain it simply, you don't understand it well
>> >> enough.«
>> >> -- Albert Einstein
>> >>
>> >> »If you don't have time to do it right, when will you have time to
>> >> do it over?«
>> >> -- 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
>>
>>
>>
>> ---
>> 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



---
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