Home>Article>Web Front-end> How to solve the Chinese garbled problem of htmltag

html 3499910bf9dac5ae3c52d5ede7383485 Solutions to Chinese garbled tags: 1. When receiving in the background, use the "ISO-8859-1" international standard for transcoding; 2. Directly transcode URLs with Chinese characters in them. code, and then decode it when receiving in the background.

How to solve the Chinese garbled problem of html <a> tag

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

The a tag of html transmits Chinese characters to the background as garbled characters

  • Problem description:

html's 3499910bf9dac5ae3c52d5ede7383485 The problem of garbled characters when tags are transmitted to the backend is that they are garbled. I started converting the jsp page and the backend to utf-8 but it didn't work. I tried the following solutions and personally tested it and it worked. In summary, I will reserve it for next time.

    Solution:
  • Method 1: Pass the value directly, and use ISO-8859- when receiving in the background 1 international standard for transcoding.
String title = request.getParameter("title"); byte[] tb=title.getBytes("ISO-8859-1"); title=new String(tb);

Method 2: Transcode the url, that is, directly transcode the URL with Chinese characters in it, and then decode it when receiving it in the background. That's it.

:

## When receiving:

##r

[Recommended Learning:

HTML video tutorial

The above is the detailed content of How to solve the Chinese garbled problem of htmltag. For more information, please follow other related articles on the PHP Chinese website!

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