ExtJS Chinese garbled GBK format encoding solution and code

Source: Internet
Author: User

I have read some Ext knowledge in the background over the past few days, and garbled characters have occurred while cutting into work projects. So I have summarized this article about the solution to the GBK format encoding of ExtJS Chinese garbled characters, as a record.

1. Details:

In Introduction:

Copy codeThe Code is as follows: <title> Ext-learning | test project </title>
02. <link href = "/js/ext/resources/css/ext-all.css" rel = "stylesheet" type = "text/css"/>
03. <script type = "text/javascript" src = "/js/ext/ext-base.js"> </script>
04. <script type = "text/javascript" src = "/js/ext/ext-all.js"> </script>
05. <script type = "text/javascript" src = "/js/ext/ext-lang-zh_CN.js"> </script>

Then, I wrote a simple example:Copy codeThe Code is as follows: <script type = "text/javascript">
Ext. onReady (
Function (){
Ext. MessageBox. alert ("tip", "Hello, world! ");
}
);
</Script>

Result:

2. The page code is GBK. The specific code is as follows::

3. Solution:

(1) The Page code is defined as normal after the UFT-8, but the project specified code is a UTF-8, so can not use this idea.

(2) The introduced resource file (/js/ext/ext-lang-zh_CN.js) to the appropriate code, the specific as follows:

A. Open the js file with EditPlus and save it as follows:

B. We can see that there are a total of five encoding options, but none of them are what we need. We click more small buttons (which of the following buttons have two inconspicuous points on them)

After you see it, select the encoding in the figure and confirm:

Then, replace the js in the project and test:

As you can see, the garbled problem has been solved, and the text display is normal.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.