2

I've recently ran into a problem and I would really use a bit of help from the community. I'm trying to load a HTML file using jQuery load().

The index file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Question</title>
    <meta http-equiv="Content-Type" Content="text/html; charset=euc-kr" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
        function restart(){
            $("#wrap").load('new-content.html').hide().fadeIn('slow');  
        }
    </script>
</head>
<body>

    <div id="wrap">
        <div id="content">Text before restart: 남성</div>
    </div>

    <br />

    <a href="javascript:void(0)" onclick="restart()">Restart</a>

</body>
</html>

The new HTML file includes some simple HTML content and a call to a .js file (used for some animations). The new content file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Question</title>
    <meta http-equiv="Content-Type" Content="text/html; charset=euc-kr" />
    <script src="main.js" language="javascript" type="text/javascript" />
</head>
<body>

    <div id="contentInner">Text after restart: 여성</div>

</body>
</html>

As you can see I've included the correct encoding charsets (for both files) and I've double checked and I can confirm that every file used for this part of the code it's encoded as "KOREAN" (checked in different apps like Dreamweaver, Notepad++, Sublime Text 2).

Yet still once I load the content the characters are not encoded properly; question marks appearing instead of characters.

Of course I made some searching before posting and I found a few helpful topics about this called the PHP header solution, but this isn't an options since it need to use HTML/JS/CSS only.

The same behavior occurs when I'm using the Japanese language too. In other latin based languages everything is working perfectly fine of course.

Any sort of input/advice/help would be much much appreciated.

Thank you!

Pavlo
  • 43,301
  • 14
  • 77
  • 113
Adrian
  • 343
  • 5
  • 19

0 Answers0