'JS - gettign and displaying attribute data - wrong string display format

I'm trying to get image title from page X - where in source view I can properly see "Neu Müller photo". Page X content charset is iso-8859-2.

So I fetch it - and simply using:

.getAttribute("title")

to get image title value - but on my page where charset is UTF-8 it is displayed wrong - like: "Neu M�ller photo"

I suppose that editor used on page X has the wrong charset setup - but there is nothing I can do there. Is there a way to fix it - to properly display it on my page?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source