search
HomeWeb Front-endJS TutorialExtJS Chinese garbled GBK format encoding solution and code_extjs

In the past few days, I have been reading some Ext knowledge in the background. When I entered the work project, garbled characters appeared, so I summarized this article about the GBK format encoding solution for ExtJS Chinese garbled characters as a record.

1. Specific situation :

Introduction:

Copy code The code is as follows:

Ext- Learning|Test Project
02.
03.
04.
05.

After that, I wrote a simple example:
Copy code The code is as follows:



The result appears:

2. The encoding of the page is GBK, the specific code is as follows :

3. Solution :

(1) Defining the page encoding as UFT-8 works fine, but the project specified encoding is UTF-8, so this idea cannot be used.

(2) Change the imported resource file (/js/ext/ext-lang-zh_CN.js) to the appropriate encoding, as follows:

A. Open this js file with EditPlus and choose Save As, as shown below:

B. You can see that there are 5 encoding options in total, but none of them are what we need. We click on the more small button at the back (the inconspicuous button with two dots on it)

After seeing the picture below, select the code in the picture and confirm:

Then, replace the js in the project and test again:

As you can see, the garbled code problem has been solved and the text is displayed normally.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
解决PHP Dompdf中文乱码问题的方法解决PHP Dompdf中文乱码问题的方法Mar 05, 2024 pm 03:45 PM

解决PHPDompdf中文乱码问题的方法PHPDompdf是一个用于将HTML文档转换为PDF文件的工具,它的功能强大且易于使用。然而,在处理中文内容时,有时会遇到中文乱码的问题。本文将介绍一些解决PHPDompdf中文乱码问题的方法,并提供具体的代码示例。一、使用字体文件在处理中文内容时,一个常见的问题是Dompdf默认不支持中

utf8编码汉字占多少字节utf8编码汉字占多少字节Feb 21, 2023 am 11:40 AM

utf8编码汉字占3个字节。在UTF-8编码中,一个中文等于三个字节,一个中文标点占三个字节;而在Unicode编码中,一个中文(含繁体)等于两个字节。UTF-8使用1~4字节为每个字符编码,一个US-ASCIl字符只需1字节编码,带有变音符号的拉丁文、希腊文、西里尔字母、亚美尼亚语、希伯来文、阿拉伯文、叙利亚文等字母则需要2字节编码。

终极解决PyCharm中文乱码问题的方法终极解决PyCharm中文乱码问题的方法Jan 27, 2024 am 08:00 AM

解决PyCharm中文乱码问题的终极方法,需要具体代码示例引言:PyCharm作为一款常用的Python集成开发环境(IDE),具有强大的功能和友好的用户界面,被广大开发者所喜爱和使用。然而,PyCharm在处理中文字符时,有时可能会遇到乱码的问题,给开发和调试带来一定的困扰。本文将介绍如何解决PyCharm中文乱码问题,并给出具体的代码示例。一、设置项目编

MySQL安装中文乱码的常见原因及解决方案MySQL安装中文乱码的常见原因及解决方案Mar 02, 2024 am 09:00 AM

MySQL安装中文乱码的常见原因及解决方案MySQL是一种常用的关系型数据库管理系统,但在使用过程中可能会遇到中文乱码的问题,这给开发者和系统管理员带来了困扰。中文乱码问题的出现主要是由于字符集设置不正确、数据库服务器和客户端字符集不一致等原因导致的。本文将详细介绍MySQL安装中文乱码的常见原因及解决方案,帮助大家更好地解决这个问题。一、常见原因:字符集设

PHP网页中文乱码怎么办?一篇完整解决方案PHP网页中文乱码怎么办?一篇完整解决方案Mar 26, 2024 pm 03:27 PM

PHP网页中文乱码问题是在网页显示中出现中文字符显示为乱码的情况,这种情况通常是由于编码不一致或者未设置字符集导致的。解决PHP网页中文乱码问题需要从多个方面入手,以下是一些常见的解决方案以及具体的代码示例。设置PHP文件编码:首先确保PHP文件本身的编码是UTF-8,可以在编辑器中设置保存时使用UTF-8编码,或者在PHP文件头部添加如下代码设置编码:&l

ajax传递中文乱码怎么办ajax传递中文乱码怎么办Nov 15, 2023 am 10:42 AM

ajax传递中文乱码的解决办法:1、设置统一的编码方式;2、服务器端编码;3、客户端解码;4、设置HTTP响应头;5、使用JSON格式。详细介绍:1、设置统一的编码方式,确保服务器端和客户端使用相同的编码方式,通常情况下,UTF-8是一种常用的编码方式,因为它可以支持多种语言和字符集;2、服务器端编码,在服务器端,确保将中文数据以正确的编码方式进行编码,再传递给客户端等等。

解决Linux系统中文乱码问题的方法解决Linux系统中文乱码问题的方法Feb 19, 2024 am 09:22 AM

Linux中文乱码问题是许多中文使用者在使用Linux系统时经常遇到的一个困扰。中文乱码的主要原因是因为Linux系统默认使用的字符编码是UTF-8,但是某些软件或应用程序可能不兼容UTF-8编码,导致中文无法正确显示。解决这个问题的方法有很多,下面将详细介绍几种常见的解决方法,并提供具体的代码示例。修改终端字符编码设置:终端的字符编码设置决定了终端能够正确

有效解决Eclipse中文乱码问题的实用方法有效解决Eclipse中文乱码问题的实用方法Jan 03, 2024 pm 05:50 PM

快速解决Eclipse中文乱码的实用技巧,需要具体代码示例概述:Eclipse是一款广泛使用的集成开发环境(IDE),它不仅支持多种编程语言的开发,也支持多种操作系统。然而,有时在使用Eclipse过程中,我们可能会遇到中文乱码的问题,这给我们的开发工作带来了不便。本文将介绍一些实用技巧,帮助我们快速解决Eclipse中文乱码问题,并附上具体的代码示例。一、

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool