Enable UTF-8 encoding for JavaScript

后端 未结 11 898
悲哀的现实
悲哀的现实 2020-12-09 10:17

I don\'t know how should I titled this question but hope my friends will understand the problem and will help me :)

I want to show log message in arabic

相关标签:
11条回答
  • 2020-12-09 10:22

    Same problem here, solved with this: In Eclipse (with .js file open and on focus), go to, "File", "Properties", "Resource", "Text file encoding" choose "Other:" UTF-8, put correct characters code inside the code save your file and you are done!

    0 讨论(0)
  • 2020-12-09 10:25

    thanks friends, after trying all and not getting desired result i think to use a hidden div with that arabic message and with jQuery fading affects solved the problem. Script I wrote is: .js file

    $('#enterOpeningPrice').fadeIn();
    $('#enterOpeningPrice').fadeOut(10000);
    

    .html file

    <div id="enterOpeningPrice">
        <p>أدخل سعر الافتتاح</p>
    </div>
    

    Thanks to all..

    0 讨论(0)
  • 2020-12-09 10:31

    Try to put in the head section of your html the following:

    <meta charset='utf-8'>
    

    I think this need to be the fist in head section. More information about charset: Meta Charset

    0 讨论(0)
  • 2020-12-09 10:36

    For others, I just had a similar problem and had to copy all code from my file, put it to simple notepad, save it with utf-8 coding and then replace my original file.

    The problem at my side was caused by using PSpad editor.

    0 讨论(0)
  • 2020-12-09 10:37

    just add your script like this:

    <script src="/js/intlTelInput.min.js" charset="utf-8"></script>
    
    0 讨论(0)
  • 2020-12-09 10:37

    I think you just need to make

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    

    Before calling your .js files or code

    0 讨论(0)
提交回复
热议问题