0

I have the following javascript, loading my menu on all of my pages

    <script type = "text/javascript">
        $(document).ready(function () {
            $("#menudiv").load("menu.html");
        });
    </script>

I havent included the menu as it is a completely standard list, formatted to look like it does. One of the menu option contains the character "å", how can I make my page display this character correctly?

3
  • What does it show now? Have you set the right encoding for the page? Commented Sep 25, 2013 at 10:09
  • what encoding are you using!? Commented Sep 25, 2013 at 10:09
  • i use <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> on the page that it is loaded onto. The curious thing is that if i take the menu, and insert the code directly on the page, the "å" shows up correctly. Commented Sep 25, 2013 at 10:11

3 Answers 3

2

This usually happens when the server doesn't set the encoding of menu.html correctly. Make sure the correct encoding is in the headers. (see this document) Especially, make sure that the Content-Type header is correct and that you have a <meta charset="..."> element in menu.html

The encoding of the existing page doesn't matter at all! Whenever you download something, the browser will look for the encoding of the new data, convert that to Unicode and only then, merge the new data with what it already has.

Sign up to request clarification or add additional context in comments.

Comments

0

add this HTML Meta tag in your page:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Or in HTML5 Way :

<meta charset="iso-8859-1">

Comments

-1

Add the following meta tag to the head of your HTML document:

<meta charset="iso-8859-1">

Use the HTML entity code for displaying this and other ISO characters:

&#229; or &aring;

More information on HTML entities from w3: http://www.w3schools.com/tags/ref_entities.asp

2 Comments

Thank you, this worked. Ill mark the answer as correct once i will be allowed to.
Using entities is unnecessary when the character encoding issue has been resolved, as it should. w3schools.com should not be cited as reference, or at all, see w3fools.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.