Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Strange Characters in the order process email


Mikepo

Recommended Posts

Posted

Hi

I've noticed that there are strange characters in the emails sent to customers to confirm there orders.

 e.g.

 

------------------------------------------------------

3 x Kontrol Streamline moisture trap (112995) = £14.97

------------------------------------------------------

Sub-Total: £14.97

Royal Mail: £2.50

VAT @ 20%: £2.50

Total: £17.47

 

I've looked through the code put can't seem to identify why this happens

 

Can anyone advise please?

Mike

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Posted

Your text (including the Pound Sterling sign) is encoded in UTF-8, but your email is going out saying it's encoded in Latin-1 (I think that's also the default). Something went wrong with your email setup. Are you trying to send HTML email, or plain text email? If the latter, I'm not sure that anything but Latin-1 is allowed, in which case you would have to change your currency setup to the Latin-1 character (is the rest of your site UTF-8?). Is the currency symbol the only problem?

Posted

I'm sending mail using plain text, so how do I setup or change my currency to the Latin-1 character, if plain text uses by default Latin-1. Im assuming the rest of my site is UTF-8. It would appear that the currency symbol is the only problem.

 

What is the difference between latin-1 and UTF-8? I need to investigate this.

 

Or would it be best to switch to html mail?

 

 

Mike

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Posted

Switching to HTML mail should certainly solve the problem. I don't know what osC is going to do if you have your currency (and the rest of the site) in UTF-8, and want to send Latin-1 mail -- I don't think it offers two currency encodings for the currency character. Give that a try first.

 

Latin-1 and UTF-8 are two different character encodings for text. They are the same for ASCII characters (7-bit x00-x7F), but differ for the rest (including the Pound Sterling sign). Latin-1 (and its closely related Windows CP-1252) uses a single byte for each of the remaining 128 characters (x80-xFF), while UTF-8 uses 2, 3, or 4 bytes for each of (potentially) millions of additional characters. So the Pound Sterling sign is in the "upper half" of Latin-1 and is a single byte, while it is 2 bytes in UTF-8. They are not interchangeable. If your currency definition supplies only one or the other, that's a problem for you.

  • 9 months later...
Posted

I'm having a similar problem only I have the A cap character in front of the £ sign on one page only (index.php) - the rest of the pages are OK.  I've never seen this in a way I can't fix before as its not happening on the whole site, just the one page.  I've tried the following:

 

Force UTF-8 using htaccess (forces whole site to change client browser to UTF-8 for the session) - doesn't work

Force character default to off in htaccess (forces browser to switch off default charset) - fix index.php, but then the rest of the site end up with the ? in a black box all over the place

Force the php to encode in UTF-8 - no change

 

Frankly as the <meta> statement to do with this is fine, I'm totally clueless as to what to do.  index.php should just encode as UTF-8 if the meta says so, yes?

 

Any ideas would be gratefully received 

Posted

Is the Pound sign in question coming from the database, fixed in a PHP file, or something else? If the <meta> tag for character encoding is definitely UTF-8, we need to look at the history of the character. Might it have been in UTF-8, exported into Latin-1/CP-1252, and imported back into UTF-8? That would export the double byte Pound sign as &Acaret; £ into two separate characters. Then importing it back into UTF-8 as a conversion from a Latin-1 file would convert the two Latin-1 characters into two multibyte UTF-8 characters! This happens all the time when people are careless when handling UTF-8 databases -- the export (backup) .sql file is imported back in as (by default) Latin-1 text, which results in two UTF-8 characters.

 

If you think your text may be from the database, and the database is UTF-8, and you had exported and imported at some point, there's a good chance that you'll see it as two characters in phpMyAdmin. If so, just delete the &Acaret; and you should be good. However, this may have happened to other places in the text (any character not ASCII), so look around carefully.

Posted

The problem I had, and still do, is this

 

Sub-Total: £3.60

 

If I look at the order process email on my PC this odd character appears before the £

 

If I look at the order process on my ipad then the odd character disappears !

 

stange, and I don't know how to fix it.

 

Mike

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...