Chinaunix
标题:
cgi程序字符出现乱码问题
[打印本页]
作者:
指针扰幽梦
时间:
2012-10-20 11:05
标题:
cgi程序字符出现乱码问题
int cgiMain()
{
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<HTML>\n");
fprintf(cgiOut, "<HTML><HEAD>\n");
fprintf(cgiOut, "<TITLE>登录提示</TITLE></HEAD>\n");
fprintf(cgiOut, "<BODY>");
fprintf(cgiOut, "<H1>%s<Hi>","登录成功,正在为你跳转");
fprintf(cgiOut, "<meta http-equiv=\"refresh\" content=\"2(此数字为2秒后跳转到main.html);url=../main.html\">");
return 0;
}
需在<HEAD></HEAD>标签之间添加相对应的字符编码格式,比如我自己的是utf-8
fprintf(cgiOut, "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=utf-8\"\n");
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2