Mixware Posted September 8, 2015 Share Posted September 8, 2015 I have the following simplified code. The alert is shown with the correct "ø". If I instead place myFunction in an external js, the alert is displayed with the character "ø" as a question mark. I have tried without success to <script src = "my.js" charset = 'utf-8'> </ script> How can I get it to work also with myFunction in an external js. <!DOCTYPE html><html><head><meta charset="UTF-8"><script>function myFunction() { alert("Søren");}</script></head><body><button onclick="myFunction()">Click</button></body></html> Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2015 Share Posted September 8, 2015 Make sure that the file is saved with a UTF-8 encoding. The option should be in your text editor. Link to comment Share on other sites More sharing options...
Mixware Posted September 9, 2015 Author Share Posted September 9, 2015 Hi Thank you. Saving the external js file with UTF-8 encoding solved the problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now