Set up your text editor (Notepad++, sublime, etc.) to save edits as UTF-8 or the charset you find most suitable for your case.
It is recommended to use a multibyte character set such as UTF-8 (No BOM).
Loading . js files
When loading a Javasscript file, it is also recommended to specify the charset used:
<script src="file.js" charset="utf-8"></script>
Specify the meta tag
In HTML, of course, specify the meta tag:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
The whole environment should be well configured.
If you are using PHP, specify the header:
header('Content-Type: text/html; charset=UTF-8');
Remarks:
The tag <meta>
has no relation to PHP. It’s HTML.
This answer addresses the use of UTF-8, however, does not necessarily mean that it is the best form or the ultimate solution. The use of UTF-8 is a recommendation to make your application’s charset internationalized as UTF-8 supports multibyte characters.
The default accepted by all browsers for HTML5 is utf-8. do not use iso-8859-1. And write the normal word without treating the characters.
– Ivan Ferrer