The 'items' text returned by the [txn-items] token becomes htmlspecialchars()-encoded by the t() function. This means that when the product title contains characters such as '&', they are replaced by their HTML-encoded replacements (ie '&'):

********************************
Order Details
********************************
1 order of Jumper & Pullie Baby Boy & Girl Bear Cubs at £7.40 each

I don't know how this would behave in an HTML-format mail but it is undesirable as plain text. To address this, the token_values function will have to either avoid the t() function, or htmlspecialchars_decode() the translated text. Since translation is desirable, I would suggest the latter.

Line 2664 in the store_token_values() function would thus become the following:

        $items .= htmlspecialchars_decode( t('@order of @title at @price each', array('@order' => format_plural($p->qty, '1 order', '@count orders'), '@title' => $p->title, '@price' => payment_format($p->price))) ). "\n";

I would have suggested decoding the whole token when inserting it into the $values array (line 2686 - '$values['txn-items'] = htmlspecialchars_decode($items);'), but I am unsure how this would affect the line breaks (if at all).

xx

Comments

kingandy’s picture

Status: Active » Needs review

Anyone?

daddison’s picture

Works for me.