Home > Web Front-end > Front-end Q&A > How to solve the Chinese garbled problem of html tag

How to solve the Chinese garbled problem of html tag

藏色散人
Release: 2021-04-12 09:45:04
Original
3633 people have browsed it

html 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 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);
Copy after login

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 html tag. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template