6

I have a code demo in lang.js:

var $lang = {
    todayStr1: "Hôm nay" // Vietnam
    todayStr2: "Today"   // English
}

When I echo $lang result is :

H?m nay
Today

How to ideas for fix utf8 in JavaScript?

2
  • What environment are you using javascript in? Commented Dec 13, 2011 at 4:48
  • 2
    Use the charset attribute of the <script> tag<script type="text/javascript" src="[path]/myscript.js" charset="utf-8"></script> Commented Dec 13, 2011 at 4:49

1 Answer 1

10

you can test it when attach lang.js

<script type="text/javascript" src="[path]/lang.js" charset="utf-8"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.