You are here:  » Sorry if this has been covered before

Support Forum



Sorry if this has been covered before

Submitted by UKJay on Sat, 2008-11-15 19:21 in

How do I import utf-8 datafeeds into the database so that they display correct punctuation rather than the utf-8 encoded version. I am now manually importing data but am running the imports as a daily CRON job.

As an example, I need to display '&' in datafeeds but this is coming through as 'amp' in the descriptions and names.

My sites are all iso-8859-1 content equivalent.

Many thanks for a superb script - best I have ever used by a long shot.

Submitted by support on Sun, 2008-11-16 10:24

Hi,

This sounds like an HTML entities problem rather than a character set issue, as the HTML entity for the & character is:

&

...however & and ; are stripped during import as part of the data sanitisation / normalisation. The easiest thing to do to avoid having to create lots of filters is perhaps to permit those characters for the description field - it is the product name where they would cause problems. To do this, look for the following code on line 165 of includes/admin.php:

$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!");

...and replace this with:

$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!&;");

(and then re-import for the changes to take effect)

Cheers,
David.

Submitted by damir on Thu, 2009-06-18 16:55

Hi David,

I have a problem that once there is & sign in the product name it can't be displayed as the name is cut by the _GET in products.php.

Do you have any suggestion for workaround to this problem?

Regards,

Danny

Submitted by support on Fri, 2009-06-19 08:15

Hello Danny,

As search.php isn't expecting these characters to be included in the product name, if you are using search engine friendly URLs ($config_useRewrite = TRUE; in config.php) it would be necessary to add urlencode() to the product name. To do this, look for the following code on line 166:

$searchresults["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";

...and REPLACE that with:

$searchresults["products"][$k]["productHREF"] = "product/".urlencode(tapestry_hyphenate($product["name"])).".html";

Cheers,
David.

Submitted by damir on Fri, 2009-06-19 14:36

Thanks David,

But the problem is not with the search.php it is with the products.php as it handle only the name part until the & and therefore cannot find the product which can be seen in the search results with encoded url.

Danny

Submitted by support on Fri, 2009-06-19 14:40

Hi Danny,

Could you perhaps email me a link to your site and your current search.php and products.php as attachments - and also a search query that will return affected products in the results - and i'll take a look for you...!

Cheers,
David.