Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display chinese character in HTML

Tags:

html

I have created web page using Chinese. When I view the page with Google chrome, all Chinese characters are corrupted. Do I have to add something in HTML page?

like image 537
user3014926 Avatar asked Dec 18 '13 22:12

user3014926


Video Answer


2 Answers

There are two ways to define the encoding of your page. You should include inside your <head> tags an encoding tag, two ways to do that follow below:

Short way:

<meta charset="utf-8"> 

Long way:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

You can have more details about the difference between these two ways in this question:

  • <meta charset="utf-8"> vs <meta http-equiv="Content-Type">

If you want to see a real example, take a look in the weibo.com source code at this line of code.

like image 92
Eliezer Bernart Avatar answered Oct 18 '22 12:10

Eliezer Bernart


Make sure to use UTF-8 or a comparable encoding. This can be made sure in the http headers:

Content-Type: text/html; charset=utf-8
like image 45
rulebot Avatar answered Oct 18 '22 13:10

rulebot