php输出UTF-8格式XML文件中文乱码问题(含asp,asp.net,jsp代码)
2010-12-17 15:56
866 查看
下面是asp.net,php,jsp等语言在输出utf-8是需要在输出开始添加三个字节的内容,不让输出的文件会有一定的问题,希望对大家有所帮助。
Using ASP.NET C#
Response.ContentType="text/xml; characterset=utf-8" ;
Response.BinaryWrite( new byte[]{0xEF,0xBB,0xBF} );
// Now write your XML data to output stream http://www.my400800.cn
Using ASP.NET VB
Response.ContentType="text/xml"
Dim UTFHeader() As Byte ={&HEF,&HBB,&HBF}
Response.BinaryWrite(UTFHeader)
' Now write your XML data to output stream
Using PHP
header ( 'Content-type: text/xml' );
echo pack ( "C3" , 0xef, 0xbb, 0xbf );
// Now write your XML data to output stream
Using ASP
Response.ContentType="text/html"
Response.AddHeader"Content-Type","text/html;charset=UTF-8"
Response.CodePage=65001
Response.CharSet="UTF-8"
Response.BinaryWrite( chrb(239) )
Response.BinaryWrite( chrb(187) )
Response.BinaryWrite( chrb(191) )
' Now write your XML data to output stream
Using JSP
response.setContentType( "text/xml; charset=UTF-8" );
OutputStream outs = response.getOutputStream();
outs.write( new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF} );
outs.flush();
// Now write your XML data to output stream
Using ColdFusion
context = getPageContext();
response = context.getResponse().getResponse();
out= response.getOutputStream();
out.write(239);
out.write(187);
out.write(191);
// Now write your XML data to output stream
Using ROR
utf8_arr = [0xEF,0xBB,0xBF]
utf8_str = utf8_arr.pack("c3")
# Now write your XML data to output stream
Using ASP.NET C#
Response.ContentType="text/xml; characterset=utf-8" ;
Response.BinaryWrite( new byte[]{0xEF,0xBB,0xBF} );
// Now write your XML data to output stream http://www.my400800.cn
Using ASP.NET VB
Response.ContentType="text/xml"
Dim UTFHeader() As Byte ={&HEF,&HBB,&HBF}
Response.BinaryWrite(UTFHeader)
' Now write your XML data to output stream
Using PHP
header ( 'Content-type: text/xml' );
echo pack ( "C3" , 0xef, 0xbb, 0xbf );
// Now write your XML data to output stream
Using ASP
Response.ContentType="text/html"
Response.AddHeader"Content-Type","text/html;charset=UTF-8"
Response.CodePage=65001
Response.CharSet="UTF-8"
Response.BinaryWrite( chrb(239) )
Response.BinaryWrite( chrb(187) )
Response.BinaryWrite( chrb(191) )
' Now write your XML data to output stream
Using JSP
response.setContentType( "text/xml; charset=UTF-8" );
OutputStream outs = response.getOutputStream();
outs.write( new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF} );
outs.flush();
// Now write your XML data to output stream
Using ColdFusion
context = getPageContext();
response = context.getResponse().getResponse();
out= response.getOutputStream();
out.write(239);
out.write(187);
out.write(191);
// Now write your XML data to output stream
Using ROR
utf8_arr = [0xEF,0xBB,0xBF]
utf8_str = utf8_arr.pack("c3")
# Now write your XML data to output stream
相关文章推荐
- php输出UTF-8格式XML文件中文乱码问题(含asp,asp.net,jsp代码)
- asp.net utf-8 中文乱码问题
- 如何解决ASP.NET下载时的中文文件名乱码,与TXT文件中存在代码两个问题
- JSP页面UTF-8格式中文字符串乱码问题解决方法
- 解决asp.net core在输出中文时乱码的问题
- 黄聪:php传递URL中文编码为带%的编码获取后乱码问题(页面utf-8格式)
- asp.net core输出中文乱码的问题
- php、asp.net关于后台设置的cookie前台JS获取时出现中文乱码问题解决
- php adodb 从mysql数据库中输出中文显示到utf编码网页乱码问题
- PHP代码中文输出乱码和转码问题
- 网页乱码 UTF-8与GB2312 及 JSP中文问题
- ASP.net连接mysql数据库中文乱码问题的解决方法
- Asp.net中的页面乱码的问题和Asp.net页面输出到EXCEL
- PHP utf-8编码问题,utf8编码,数据库乱码,页面显示输出乱码
- asp.net mvc 后台代码在前台输出时出现 & 等乱码
- PHP字符串截取函数(解决中文乱码问题!支持UTF-8和GB2312)
- PHP 发送UTF-8编码中文邮件标题乱码问题解决
- ASP.NET 2.0 解决中文乱码问题
- php中文乱码问题以及页面显示部分后台代码问题