1

I'm using Visual Studio 2015 enterprise version, and editing cshtml page. I would like to display Chinese characters like

中国China

. After I save it. It will display

??China

in html code. I have checked the page is in utf-8 character set.

All help are appreciated.

The code is as follows:

<h2>中国China</h2>

Is there any view-page code setting in somewhere?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
connie
  • 71
  • 7

1 Answers1

0

First of all, depending on your browser, set its encoding format to "auto detect/Unicode" to ensure Unicode format used.

Firefox: View => Text Encoding => Auto Detect/Unicode

Chrome: Pop-out side menu => More tools => Encoding => Auto detect/Unicode

If the browser can't display those characters properly after encoding settings changed, set the meta tag on your Layout/view page as this to declare Chinese encoding GB-2312:

<meta charset="GB2312" />

and/or use language attribute on html tag:

<html lang="zh-Hans">...</html>

Other way to change page language encoding on view page is using File => Save As, click the drop down arrow besides Save button to see Advanced Save Options, then choose proper codepage for your page (by default it sets as Unicode (UTF-8 with signature) - Codepage 65001.

Additional note: Ensure you have at least a Unicode font with CJK characters available on your system Fonts directory.

Similar problem: how to display chinese character in HTML

Community
  • 1
  • 1
Tetsuya Yamamoto
  • 24,297
  • 8
  • 39
  • 61