PDA

View Full Version : incorrect encoding of £ symbol.


CraigR
07-19-2010, 12:08 PM
Not sure where to put this, as although occuring in ecart, it isn't an ecart problem.

i have manipulated a few coupons to retreive various options from a database.

On adding 'saddle' as the voucher code, when a particular item is in the cart, a £25 discount is added.
The cart display object retrieves the text string from the database and displays it in discounts, when the code is entered, however the £ sign is not displayed propely. (it seems to work with $).

I have changed my table so that the data is utf8, but still no joy.
link to test page...

http://www.test.stonepits.com/productdetail.php?ItemType=4&Item=54

just click on the add to cart button and type 'saddle' in the voucher box

Jason Byrnes
07-19-2010, 01:00 PM
does it show the pound sign correctly in the database?


if so, try adding the following at line 1 of your page:

<?php
ini_set('default_charset', 'utf-8');
?>

CraigR
07-19-2010, 01:05 PM
hi Jason.

Yes, the £ is fine in the database.

I already have <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> in the head of my page.

I added the line you suggested, but this seems to make no difference.

Jason Byrnes
07-19-2010, 01:19 PM
try adding that into the eCart coart object php file as well.


you may also need to set the client connection being used by php.

open the connection file in the connections folder, and find the last line, it will look like:

$<Connection Name> = mysql_pconnect($hostname_<Connection Name>, $username_<Connection Name>, $password_<Connection Name>) or trigger_error(mysql_error(),E_USER_ERROR);


where <Connection Name> is the name of the connection, add the following to the next line:

mysql_set_charset('utf8', $<Connection Name>);

CraigR
07-19-2010, 01:23 PM
Hi Jason.

The edit to the database connection file works ! (at least on my local server).

Any more issues, I'll let you know.

Many thanks

--update, works on live server in testing area too ! :-)

Jason Byrnes
07-19-2010, 01:25 PM
awesome, glad to hear it's working.