dropdown doesn't display UTF-8 correctly

1.2k views Asked by At

I have a <select> element with some options on a dropdown. on that dropdown i have product some of these product have names that come up with special characters like é. But on the front-end instead of showing the é it shows the ä characters.

for solution I tried to use special characters like É for é inside a textfield. But when I replace the é with É inside a textfield, on the front-end it shows the É My magento store charset is utf8.

i want to use é, $, ä etc... of my Magento store. is there any way to solve this problem tihs doesn't affect the rest of the website

2

There are 2 answers

0
David Johansson On

You will have to save the file in UTF-8 as well. Both the file presenting the text, as well as the file that outputs the data that populates the selectbox.

A common misstake, at least for myself, is that when working with UTF-8, you have to ensure that everything is saved using it. Scripts, codebehind, html - Everything.

1
Angus Walker On

David Johansson is correct.

I had the same problem with a box with a list of names. I populated it via a function that looked up the people and created the lines for each person found. However people with names containing accents didn't display correctly.

I resolved it by running my result through iconv before returning the value.

return iconv('ISO-8859-1','UTF-8', $retval);