C++ Builder 在使用TIdHTTP控件获取网页(UTF-8编码方式)源码时出现乱码
测试url:http://blog.csdn.net
获取的源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona
l//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head> <script id="allmobilize" charset="utf-8"
src="http://a.yunshipei.com/1327c36bdd7197e30fd9f4b48d1a5bcc/allmobilize.min.js"
></script><meta http-equiv="Cache-Control" content="no-transform" /
><link rel="alternate" media="handheld" href="#" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSDN璁哄潧棣栭〉 - CSDN.NET</title>
<script src="/assets/application-594a8b024032fedaa5d3c4c61a1b3d17.js"
type="text/javascript"></script> <script type="text/javascript"> $(function() { main_page_js.index_page(); }); </script> <link href="http://csdnimg.cn/www/images/favicon.ico" rel="SHORTCUT ICON"> </head> <frameset cols="230,*" frameborder="no" border="0" framespacing="0"> <frame src="/left_menu" name="leftFrame" noresize="noresize" id="leftFrame" title="leftFrame" /> <frame src="/home" name="mainFrame" id="mainFrame" title="mainFrame" /> </frameset> <noframes> <body> </body> </noframes></html>
请问如何转换?
utf-8 乱码
[解决办法]
获取完文本以后,用AnsiToUtf8转码。