0

My Product names contains double quotes ( " ) in their name.
Example product name : Test Product(s) -14 cm - (1.6 mm)-1"-Red
Now when I am trying to export my report in xml format, the name is appearing as Test Product(s) -14 cm - (1.6 mm)-1"-Red


I have tried code htmlspecialchars before rendering the name, but it is still appearing wrong.


Below are the codes that I have tried

htmlspecialchars_decode($row->getProductName());
htmlspecialchars_decode($row->getProductName(), ENT_QUOTES);
html_entity_decode($row->getProductName());

Please let me know how this can be fixed and if any one faces any similar issue earlier.

3

That's expected behaviour, since the exports in Magento encode HTML by default. In this case, you're experiencing this with a double quote, which might not be a problem here, but when this value was used as an attribute on a tag, or when your product name contained a "<" or ">", that will cause issues with the syntax of your XML and might even make it possible to add custom (malicious) elements to your XML export.

So, I would not suggest to "fix" this, but leave it as is. I don't know where you want to use the exported file, but you might want to check if that system will change this itself. If not, you might want to search and replace with a text editor before importing the file again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.