I have this script included in the body of my html file:

<script>
function read() {
    $.get("prevision.txt", function(data) {
        $('#prev').html(data);
    });
}

$(document).ready(read); </script>

When there is an accent included in the .txt file, the #prev shows: � instead of an accent.

I have all files encoded as UTF-8. How can I solve this?

Thanks

有帮助吗?

解决方案

Use the html codes instead of true characters.

for Ex.

'<' == '&lt;' // true

complete reference for accented chars here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top