You are here:  » Stripping Copyright and TM symbols


Stripping Copyright and TM symbols

Submitted by bat on Sat, 2012-12-08 15:36 in

Hi David
I've come across some symbols that will not be replaced by Search and Replace or removed by Strip HTML filters.
The symbol seems to actually be a whole symbol rather than made up of code, which would explain why Strip HTML doesn't work. However, I've put the symbol in whole in the Search and Replace and that doesn't work either.
It's becoming awkward as I'm unable to product map these particular products with the dodgy symbols in them. The symbols don't appear as they should either, they appear as a diamond with a question mark in the middle.

Any idea on how to remove them?

Thanks!

Submitted by support on Sat, 2012-12-08 16:03

Hi bat,

Do the characters appear correctly in the main site but not within Product Mapping? Could you perhaps post a link to a product page that shows the characters and I'll double check how they're encoded. I was going to suggest the HTML entities of © and ™ but that should work fine within Product Mapping - the black diamond ? indicates a character encoding mismatch between content and the declared character set of the page but both main site and admin pages should be output with the same character set (as defined in config.php line 4).

I'll check how they're encoded and if it would be possible to have temporary access to /admin/ I'll take a look at how they appear within Product Mapping for you (I'll remove all details before posting your reply)...

Thanks.
David.
--
PriceTapestry.com

Submitted by bat on Sat, 2012-12-08 16:44

They appear as the black diamond on the site itself. The only reason I know what they are is because some manual feeds I made produced these black diamond ? symbols. Obviously the manual feeds I can change because they are static and do not update, but merchant's feeds that I auto-update I cannot manually change as the changes will be overwritten at every update.

Here's an example {link saved}

The products with the black diamond? symbols do not appear at all in the Product Mapping search box. As you can see from that product example, the name doesn't even show up in the meta title, when it should.

Submitted by support on Sat, 2012-12-08 17:48

Thanks, bat.

The first issue is a character encoding mis-match between the characters in the feed and the character set configured for your site. When I view your example page, I if go to the browser's View > Character Encoding menu and change to ISO-8859-1 the trademark symbols then appear correctly.

Assuming that the majority of your feeds are in UTF-8 and therefore that is the most appropriate character encoding to use, the first thing I would suggest would be to add UTF8 Encode filters to the Product Name and Description fields of that feed, and then re-import and check how those characters then appear on the site / within mapping / filter tools.

That may be sufficient to be able to resolve the problem as required, but if not let me know once the filters are in place and I'll take another look, and if it would be OK to have temporary access to /admin/ of the installation I'll check it out within Product Mapping for you...

Thanks,

David.
--
PriceTapestry.com

Submitted by bat on Sat, 2012-12-08 18:59

The Encode filter seems to have done the trick. Thank you very much, David!

Submitted by bigshopper on Thu, 2018-10-18 18:33

Hi,

Due to the fact that some titles/brands must have a TM or (R) symbol, I would like to only strip them from the URL's. How to do this? With the search/replace filters, they will be removed in the titles as well (there I would like to keep them).

Thanks in advance.

Robert

Submitted by support on Fri, 2018-10-19 08:29

Hello Robert,

You could add a search and replace to the tapestry_normalise() function (includes/tapestry.php) to remove any specific UTF-8 characters that you would like to remove from the URL. To do this, look for the following code at line 22:

    $text = str_replace("-"," ",$text);

...and REPLACE with:

    $text = str_replace("-"," ",$text);
    $text = str_replace(array("®","™"),"",$text);

Cheers,
David.
--
PriceTapestry.com

Submitted by bigshopper on Fri, 2018-10-19 12:47

Hi David,

If I change the code, it causes all the images not to work anymore with the rewrite. I don't know what causes the conflict, later on in the tapestry.php this modification was made:

function tapestry_productHREF($product)
{
$replace = array(
'á' => 'a', 'â' => 'a', 'à' => 'a', 'ä' => 'a', 'ã' => 'a', 'å' => 'a', 'æ' => 'ae', 'é' => 'e', 'è' => 'e', 'ë' => 'e', 'ê' => 'e', 'í' => 'i', 'ì' => 'i', 'ï' => 'i', 'î' => 'i', 'ó' => 'o', 'ò' => 'o', 'ô' => 'o', 'ö' => 'o', 'ø' => 'o', 'ß' => 's', 'ú' => 'u', 'ù' => 'u', 'ü' => 'u', 'û' => 'u','Á' => 'a', 'Â' => 'a', 'À' => 'a', 'Ä' => 'a', 'Ã' => 'a', 'Å' => 'a', 'Æ' => 'ae', 'É' => 'e', 'È' => 'e', 'Ë' => 'e', 'Ê' => 'e', 'Í' => 'i', 'Ì' => 'i', 'Ï' => 'i', 'Î' => 'i', 'Ó' => 'o', 'Ò' => 'o', 'Ô' => 'o', 'Ö' => 'o', 'Ø' => 'o', 'ß' => 's', 'Ú' => 'u', 'Ù' => 'u', 'Ü' => 'u', 'Û' => 'u'
);

Submitted by support on Fri, 2018-10-19 13:44

Hi,

It looks like the above modification was added as part of making URLs lower case in which case, I would suggest moving the search and replace associated with the that modification into the tapestry_normalise() function - inserted immediately following the REPLACEment code in this comment above and operating on the $text variable.

There are multibyte string to lower case functions, but if the above is working as you would like it's no less efficient and by moving the search / replace into the normalise function would remove the need for multibyte operations on every page view...

Cheers,
David.
--
PriceTapestry.com

Submitted by bigshopper on Fri, 2018-10-19 14:26

Hi David,

Thanks for your response, I changed the code, first it didn't work, then I changed it to this order:

{code saved}

The website is working, but it has no impact on the URL's. If I put the replace function below the two lines of your earlier comment, the website is not working anymore.

Cheers,

Robert

Submitted by support on Mon, 2018-10-22 07:16

Hello Robert,

As I'm not sure exactly what code was in the original modification to the tapestry_productHREF() function; please could you email me the working includes/tapestry.php with the accented vowel etc. replaced code in place at that point, and I'll advise how it could be moved to the tapestry_normalise() function..

Thanks,
David.
--
PriceTapestry.com