PDA

View Full Version : Small problem with the AWS script



chef
07-21-2004, 03:21 PM
Hi,

First of all, cheers for the excellent AWS PHP tutorial. Been messing around with it and it seems to work a treat.

One small query. I'm using Amazon.co.uk for the data and all my prices have got that funny  sign before the pound. eg £18.99

Anyone got any idea why this is happening?

Thanks in advance
Chef

Chris
07-21-2004, 04:44 PM
Hi,

First of all, cheers for the excellent AWS PHP tutorial. Been messing around with it and it seems to work a treat.

One small query. I'm using Amazon.co.uk for the data and all my prices have got that funny  sign before the pound. eg £18.99

Anyone got any idea why this is happening?

Thanks in advance
Chef

Not sure why, could be an encoding thing. But it is easy enough to fix. Before echoing the price do a str_replace and get rid of it.

AndyH
07-21-2004, 06:25 PM
From the Web Services FAQ:

5) Why do the responses I get from AWS contain incorrect characters? For example, I am getting a question mark in place of a pound currency sign in my UK responses.
Data in AWS responses is UTF-8 encoded. To display the data on Web pages, you can either decode the data to another encoding format or encode your Web pages in UTF-8 as well.

chef
07-22-2004, 01:57 AM
Thanks Lads. Appreciate that.
Will have a crack at a str_replace tonight and see if that does the trick.
Cheers

chef
07-24-2004, 07:30 PM
Lads, Apologies for being a fool about it, but could anyone spell out exactly how to do that str_replace?

Here's the code that displays the prices. Should I put it in here?

<!-- list price -->
List Price: <strong><?=$ListPrice?></strong><br />

<!-- our price -->
Our Price: <strong><?=$OurPrice?></strong><br />

mobilebadboy
07-24-2004, 08:02 PM
<!-- list price -->
<?
$ListPrice = str_replace("Â", "", $ListPrice);
?>
List Price: <strong><?=$ListPrice?></strong><br />

<!-- our price -->
<?
$OurPrice = str_replace("Â", "", $OurPrice);
?>
Our Price: <strong><?=$OurPrice?></strong><br />

That should work. str_replace (http://www.php.net/str_replace).

tomek
07-25-2004, 12:30 AM
it would be better if you fix the problem and not the symptoms...

intelliot
07-25-2004, 12:42 AM
agreed, but that's simply too difficult :p

chef
07-25-2004, 01:08 PM
Thanks a mil for that.
Works perfectly.
Much appreciated.






<!-- list price -->
<?
$ListPrice = str_replace("Â", "", $ListPrice);
?>
List Price: <strong><?=$ListPrice?></strong><br />

<!-- our price -->
<?
$OurPrice = str_replace("Â", "", $OurPrice);
?>
Our Price: <strong><?=$OurPrice?></strong><br />

That should work. str_replace (http://www.php.net/str_replace).