<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
//江雪 2001.06.11 http://asnowcn.at.china.com//将&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;-8&lt;A href="http://www.66of.com" target=_blank&gt;字符串转为&lt;/A&gt;代码页为CodePage的AnsiString。function &lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8ToAnsiString(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str:string; CodePage:integer):AnsiString;var i:integer; buffer:widestring; ch,c1,c2:byte;begin result:=''; i:=1; while i&lt;=Length(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str) do begin ch:=byte(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str[i]); setlength(buffer,length(buffer)+1); if (ch and $80)=0 then //1-byte buffer[length(buffer)]:=widechar(ch) else begin if (ch AND $E0) = $C0 then begin // 2-byte inc(i); c1 := byte(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str[i]); buffer[length(buffer)]:=widechar((word(ch AND $1F) SHL 6) OR (c1 AND $3F)); end else begin // 3-byte inc(i); c1 := byte(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str[i]); inc(i); c2 := byte(&lt;A href="http://www.66of.com" target=_blank&gt;UTF&lt;/A&gt;8str[i]); buffer[length(buffer)]:=widechar( (word(ch AND $0F) SHL 12) OR (word(c1 AND $3F) SHL 6) OR (c2 AND $3F)); end; end; inc(i); end; //while i := WideCharToMultiByte(codePage, WC_COMPOSITECHECK or WC_DISCARDNS or WC_SEPCHARS or WC_DEFAULTCHAR, @buffer[1], -1, nil, 0, nil, nil); if i&gt;1 then begin SetLength(Result, i-1); WideCharToMultiByte(codePage, WC_COMPOSITECHECK or WC_DISCARDNS or WC_SEPCHARS or WC_DEFAULTCHAR, @buffer[1], -1, @Result[1], i-1, nil, nil); end;end;<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>