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

Erik Andreas Cayré erik at cayre.dk
Mon May 7 12:34:39 MDT 2007


Thanks Andrew for the extra research (which I should have done...),

I finally decided to try UTF-8, yesterday. My code is just sending  
copies to me with my test when an actual receipt is being sent (I'm  
lazy).
Noone has yet made a purchase using a language other than danish, so  
I'm waiting to see the outcome.

Just now after reading your posts, I decided to do a little more  
testing.
I found that decoding € to UTF-8 works fine, but to  
ISO-8859-15 does not.

Strangely, decoding € works fine with either encoding. I wonder  
if this is a bug in my PHP version (5.2.1)...

This is the code used to test (shown in an XHTML 1.0 strict page with  
appropriate charset of course):

	echo $string = '&AElig;blegr&oslash;d: 10&euro;<br/>
';
	echo html_entity_decode($string, ENT_COMPAT, 'UTF-8');


Den 07/05/2007 kl. 18.02 skrev Andrew Denman:

> Upon further reading, I think the ISO 8859-15 codes are actually  
> x00A4 or just xA4, though it seems to be doing ok with the x20A4.
>
> x00A4 in UTF-8 should be the "Currency Sign" ¤, which is the symbol  
> that was replaced in ISO 8859-15 with the Euro.  You can try  
> putting all these codes in and see what you get.
>
> As far as a solution for you, if you could use UTF-8 in both the  
> email and the web it seems like the easiest fix.  Otherwise you'll  
> have to set the code for output to the web and email separately.
>
> Andrew Denman
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list- 
> bounces at mail.iviking.org] On Behalf Of Andrew Denman
> Sent: Monday, May 07, 2007 10:46 AM
> To: 'FX.php Discussion List'
> Subject: RE: [FX.php List] The Euro sign (&euro; or &#x20AC;) in  
> email messages
>
> http://en.wikipedia.org/wiki/ISO_8859-15
>
> € (Euro) = x20A4
> ¬ (not sign) = x20AC
>
> Now as far as I can tell, x20AC is the Euro code in UTF-8 (x20A4 is  
> the Lira).  Can you set the encoding for the email as UTF-8?
>
> Andrew Denman
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list- 
> bounces at mail.iviking.org] On Behalf Of Erik Andreas Cayré
> Sent: Saturday, May 05, 2007 6:47 AM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] The Euro sign (&euro; or &#x20AC;) in  
> email messages
>
>
> Den 05/05/2007 kl. 13.18 skrev Gjermund Gusland Thorsen:
>
>> Can you look at the headers of your mail receipt?
>
> Sure:
>
> 	Fra: 	  php at dagkort.dk
> 	Emne: 	Dagkort.dk Bestellnummer: 22412
> 	Dato: 	4. maj 2007 8.36.44 GMT+02:00
> 	Til: 	  erik.cayre at dagkort.dk
> 	Svar til:: 	  service at dagkort.dk
> 	Return-Path: 	<www at mika.avalonia.dk>
> 	Received: 	from josef.avalonia.dk ([62.243.190.20] verified) by
> elias.avalonia.dk (CommuniGate Pro SMTP 5.1.3) with ESMTP id 10158599
> for erik.cayre at dagkort.dk; Fri, 04 May 2007 08:36:45 +0200
> 	Received: 	from pasmtpA.tele.dk (pasmtpa.tele.dk [80.160.77.114]) by
> josef.avalonia.dk (Postfix) with ESMTP id B9C069C6B8D for
> <erik.cayre at dagkort.dk>; Fri,  4 May 2007 08:36:45 +0200 (CEST)
> 	Received: 	from gabriel.avalonia.dk (gabriel.avalonia.dk
> [62.243.190.22]) by pasmtpA.tele.dk (Postfix) with ESMTP id
> A03418000B1 for <erik.cayre at dagkort.dk>; Fri,  4 May 2007 08:36:45
> +0200 (CEST)
> 	Received: 	from mika.avalonia.dk (mika.avalonia.dk [62.243.190.71])
> by gabriel.avalonia.dk (Postfix) with ESMTP id 1D41077C68 for
> <erik.cayre at dagkort.dk>; Fri,  4 May 2007 08:36:45 +0200 (CEST)
> 	Received: 	by mika.avalonia.dk (Postfix, from userid 70) id
> BA0521A66FEA; Fri,  4 May 2007 08:36:44 +0200 (CEST)
> 	Mime-Version: 	1.0
> 	Content-Type: 	text/plain; charset=ISO-8859-15
> 	Content-Transfer-Encoding: 	quoted-printable
> 	X-Mailer: 	PHP/4.3.6
> 	Message-Id: 	<20070504063644.BA0521A66FEA at mika.avalonia.dk>
>
> // snip
>
> Summe bezahlt: DKK 111,- (¬ 14,89) (inkl. Gebühr: DKK 11,- (¬ 1,48))
>
> // snip
>
>
>
>
>> ggt667
>>
>> On 5/5/07, Erik Andreas Cayré <erik at cayre.dk> wrote:
>>>
>>> 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(
>>>>               ' (&#x20AC;&nbsp;' . number_format ($dkk / $euro,
>>> 2, ',', '.') .
>>>> ')',
>>>>               'da' => 'DKK&nbsp;',
>>>>               ''
>>>>       );
>>>>       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
>>>
>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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