I use german umlauts in sentence in jQuery. In HTML i the codes are e.g for ä -> ä.
Now i display a sentence with a ä in it. When i use ä, it displays the code. When i use simply a ä, it displays �.
How is the HTMLcode for umlaut in jQuery?
Code:
var choseError = 'Bitte wähle ein Album aus!';
//or
var choseError = 'Bitte wähle ein Album aus!';
$('.album').text(choseError);
jQuery.text()inserts the given text as a textNode, i.e. whatever you put in there will appear exactly as is, it is not interpreted as HTML.jQuery.html()interprets the given text as HTML and inserts it, which would mean your HTML entities are interpreted.What you really want to do is to correctly handle encodings. You do not need to use HTML entities for umlauts or other non-ASCII characters, you simply need to make sure the browser knows what encoding the text is in and handles it correctly. It appears your text (source code) is encoded in Latin-1, but the browser is interpreting it as UTF-8. Set appropriate HTTP
Content-Typeheaders to tell the browser the content is Latin-1 encoded, or, better, save your text as UTF-8.