0

I am trying to load a text file in HTML page. The content of the text file is in German and I see � this symbol for German characters ä,ö,ü. I have used <meta charset="UTF-8"> in the head tag of html page and also tried saving the text file in ANSI and UTF-8 but didn't work. Here is my code:

$.ajax({
    type: "GET",
    url: lnk3,
    crossDomain: true,
    dataType:"text",
    processData: false,
    xhrFields: {
        withCredentials: true
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) { 
          console.log("Ajax call failed");
    },
    success: function(jsonData) {
        $("#description").html(jsonData);
    }

 });

and the HTML Code

<html>
<head>
<meta charset="UTF-8">  
<script src="jquery-2.1.3.min.js"></script>
<script src="base64.js"></script>  

</head>
<body>   
   <div id="demo3">
        <button class="bck" onclick="loadFile()">Back</button>

    </div>

        <div id="description">
        </div>

</body>   
</html>

Text file is loaded in div tag with id="description" and the text file that I want to load is stored on sharepoint

Please help me to solve this issue

Shardul Sane
  • 11
  • 1
  • 2
  • possible duplicate of [How can I properly display German characters in HTML?](http://stackoverflow.com/questions/423693/how-can-i-properly-display-german-characters-in-html) – Guruprasad J Rao Aug 05 '15 at 04:51
  • @Shardul Sane hi it's due to the special characters(german lang) in your text you might not have your html as "**Encoding with UTF-8**" just try your once again with encoding and it will work – Himesh Aadeshara Aug 05 '15 at 04:52
  • should work with text file encoded in utf-8 – Kaiido Aug 05 '15 at 05:00
  • This might solve the problem. http://www.cybervaldez.com/how-to-remove-those-nasty-question-mark-with-a-diamond-symbols-from-appearing-in-your-website/2009/ – sanjeev shetty Aug 05 '15 at 05:00
  • http://www.joelonsoftware.com/articles/Unicode.html – royhowie Aug 05 '15 at 05:21

1 Answers1

1

Make sure that your browser has set the encoding to UTF-8. In chrome you can check this by customize(right corner)->more tools->encoding->UTF-8. If it is not utf-8, then there is something wrong with the meta tag.

dpanshu
  • 453
  • 3
  • 14