English 中文(简体)
Delphi XE2: UTF16LE -> UTF8
原标题:Delphi XE2: UTF16LE -> UTF8

URL : http://www.gagalive.kr/livechat1.swf?chatroom=~~~BBQ

页: 1

procedure TForm1.FormCreate(Sender: TObject);

begin

 IdTCPClient.Host :=  61.97.246.131 ;

  IdTCPClient.Port := 8080;

  IdTCPClient.Connect;

  IdTCPClient.IOHandler.Write( Ag8m  + Char(0));

  IdTCPClient.IOHandler.Write( LShady|###BBQ  + Char(0));

  IdTCPClient.IOHandler.Write( #  +  Some Text   + Char(0));

  IdTCPClient.Disconnect;

end;

页: 1

function UTF8FromUTF16_2(sUTF16: UnicodeString): UTF8String; 

begin   

  Result := sUTF16; 

end; 

procedure TForm1.FormCreate(Sender: TObject);

begin

 IdTCPClient.Host :=  61.97.246.131 ;

  IdTCPClient.Port := 8080;

  IdTCPClient.Connect;

  IdTCPClient.IOHandler.Write( Ag8m  + Char(0));

  IdTCPClient.IOHandler.Write( LShady|###BBQ  + Char(0));

  IdTCPClient.IOHandler.Write(UTF8FromUTF16_2( #  +  안녕   + Char(0)));

  IdTCPClient.Disconnect;

end;

? 工作

[2] :不工作(铺设碎块;沙迪:吗?)

见:。 http://www.gagalive.kr/livechat1.swf?chatroom=~BBQ

UTF8FromUTF16 行使原《VB法典》的职能: iii

Help me.. :(

问题回答

“UTF-16”在XE2中编码。 第2号并不奏效,因为你正在通过<代码>UTF8String,其中预计有UnicodeString,因此,RTL将进行UTF-8->UTF-16在数据出现故障之前进行转换,然后Indy将UTF-16数据转换为传输过程中自己的违约编码。

如果您希望将<条码>统一编码作为“UTF-8”,你必须告诉Indy,通过TIdTextEncoding。 类别:

procedure TForm1.FormCreate(Sender: TObject); 
begin 
  IdTCPClient.Host :=  61.97.246.131 ; 
  IdTCPClient.Port := 8080; 
  IdTCPClient.Connect; 
  IdTCPClient.IOHandler.Write( Ag8m #0); 
  IdTCPClient.IOHandler.Write( LShady|###BBQ #0); 
  IdTCPClient.IOHandler.Write( #안녕 #0, TIdTextEncoding.UTF8); // <-- here
  IdTCPClient.Disconnect; 
end; 

或:

procedure TForm1.FormCreate(Sender: TObject); 
begin 
  IdTCPClient.Host :=  61.97.246.131 ; 
  IdTCPClient.Port := 8080; 
  IdTCPClient.Connect; 
  IdTCPClient.IOHandler.DefStringEncoding := TIdTextEncoding.UTF8; // <-- here
  IdTCPClient.IOHandler.Write( Ag8m #0); 
  IdTCPClient.IOHandler.Write( LShady|###BBQ #0); 
  IdTCPClient.IOHandler.Write( #안녕 #0);
  IdTCPClient.Disconnect; 
end; 

如果你不告诉因努迪语而使用,那就会拖欠ASCII,因为后者将腐蚀/披露你统法协会的数据。





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签