0

How to display Chinese characters in ASP using response.write?

<%
  Response.CodePage=51936
  Response.Charset="UTF-8"
  Response.ContentType = "text/html"
  Dim Msg
  Msg="简"
%>
<%Response.Write Msg%>
dda
  • 6,030
  • 2
  • 25
  • 34
TrustyCoder
  • 4,749
  • 10
  • 66
  • 119

2 Answers2

3

Codepage 51936 is EUC-CN. Not UTF-8, which is 65001.

dda
  • 6,030
  • 2
  • 25
  • 34
  • Response.Write always emits non Chinese characters no matter the codepage set – TrustyCoder Dec 05 '12 at 13:02
  • What's the encoding of your text editor? The whole tool chain must be in the same encoding... – dda Dec 05 '12 at 13:22
  • I am using UTF encoding without BOM. Should all the pages have the same encoding. Actually what I am doing is defining that needs to be translated in a single page and including them in other pages. other pages might have different encoding. – TrustyCoder Dec 05 '12 at 14:32
  • You're setting yourself up for more pain than you should. Please realize that in static strings like `Msg="简"`, 简 will be in whatever encoding your .asp page is. Which means that `Response.CodePage=XXXXXX` and `Response.Charset="xxxx"` will have to be in the same encoding... – dda Dec 05 '12 at 14:38
0

This long quiet question, still needs a verified solution! I was successful in displaying Chinese and Korean characters from a UTF-8 encoded Classic ASP script. All I did was simply add the meta charset tag in the head of the document, like so:

<%@ Language=VBScript %>
<% 
  chinese="欢迎" 
%>
<html>
<head>
  <meta charset="UTF-8" />
  ...
</head>
<body>
  <%= chinese %>
</body>
</html>
Awerealis
  • 602
  • 6
  • 9