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.