I’m scraping a site and pulling in some product content that has special characters such as ®
The special characters show up just fine in the browser but they mess up my Omniture tags, specifically the s.products tag. The s.products variable divides its sections by a semi-colon and has a total of 6 sections per product (s.products=”Category”;”Product name”;”Quantity”;”Total Price”;”Incrementor”;”Merchandising”). If the product has® in its name, then an extra semicolon is added to the s.products variable string. This messes everything up and shifts everything in the string to the right, which affects the Quantity and Price.
Is there a way to use URL encoding for the product names so that the ® is converted to a %AE? I tried the rawurlencode and htmlspecialchars functions but they didn’t work
Use both
html_entity_decodeandurlencode:Alternatively, you can regex-replace all htmlentities: