migrating from Delphi 6 With Indy 10 to XE7 with Indy 10

I updated the original Indy in D6 to version 10 several years ago.  Now I want to migrate my application from D6 to XE7 and would like some feedback on the best route to take.  I usually send data using readln and writeln statements.  The data is typically XML format.  Since migrating to XE7 will include potential unicode data what is the best approach to take when reading and writing data?  Will writeln and readln work in these cases or should I be using a different strategy to send unicode data between 
the tidtcpclient and tidtcpserver applications?
0
al
3/20/2015 8:57:53 AM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

3 Replies
1910 Views

Similar Articles

[PageSpeed] 11

al wrote:

> I usually send data using readln and writeln statements.

I assume you are referring to the TIdIOHandler.ReadLn() and TIdIOHandler.WriteLn() 
method.

> Since migrating to XE7 will include potential unicode data what is the
> best approach to take when reading and writing data?

You should set the TIdIOHandler.DefStringEncoding property to UTF-8, or specify 
UTF-8 in the AByteEncoding parameter of ReadLn() and WriteLn().  You should 
have been doing that even in your D7 code.  In fact, there are also a TIdIOHandler.DefAnsiEncoding 
property, and ASrcEncoding/ADestEncoding parameters on ReadLn() and WriteLn(), 
to account for AnsiString in D2007 and earlier.

-- 
Remy Lebeau (TeamB)
0
Remy
3/20/2015 5:48:03 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> al wrote:
> 
> > I usually send data using readln and writeln statements.
> 
> I assume you are referring to the TIdIOHandler.ReadLn() and TIdIOHandler.WriteLn() 
> method.
That is correct.  My mistake for not clarifying.
> 
> > Since migrating to XE7 will include potential unicode data what is the
> > best approach to take when reading and writing data?
> 
> You should set the TIdIOHandler.DefStringEncoding property to UTF-8, or specify 
> UTF-8 in the AByteEncoding parameter of ReadLn() and WriteLn().  You should 
> have been doing that even in your D7 code.  In fact, there are also a TIdIOHandler.DefAnsiEncoding 
> property, and ASrcEncoding/ADestEncoding parameters on ReadLn() and WriteLn(), 
> to account for AnsiString in D2007 and earlier.

I will veryfy the syntax for my D6 version and hopefully it was supported in that version of indy 10 that I have been using.  I gather from your response that the tidiohandler.readln and writeln are acceptable.
> 
> -- 
> Remy Lebeau (TeamB)
0
al
3/20/2015 8:47:34 PM
al wrote:

> I gather from your response that the tidiohandler.readln
> and writeln are acceptable.

In general, yes, provided the XML you are sending does not have any line 
breaks in its data, and that the client and server are using the same encoding 
when converting the XML string to bytes and back.  Remember, sockets don't 
know anything about strings, only about bytes.  In a Unicode environment, 
it is very important that you manage string<->byte conversions correctly. 
 In an Ansi environment, it is still important, but it is also easier to 
get away with not paying attention to it (which is why many people get into 
trouble when they migrate from Ansi to Unicode).

-- 
Remy Lebeau (TeamB)
0
Remy
3/20/2015 8:55:12 PM
Reply:

Similar Artilces:

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

Indy 10.6 compiler error with Delphi 6
In IdWinsock2.pas, lines 5684 to 5687, some IFDEFs seem to be missing to work around the missing unit64 type in Delphi 6: Here is the 'fixed' code with IFDEFs PeerApplicationAccessTokenHandle : {$IFDEF HAS_UInt64}UInt64{$ELSE}Int64{$ENDIF}; PeerMachineAccessTokenHandle : {$IFDEF HAS_UInt64}UInt64{$ELSE}Int64{$ENDIF}; MmSaId : {$IFDEF HAS_UInt64}UInt64{$ELSE}Int64{$ENDIF}; QmSaId : {$IFDEF HAS_UInt64}UInt64{$ELSE}Int64{$ENDIF}; -- Michael Justin Hello Michael, > In IdWinsock2.pas, lines 5684 to 5687, some IFDEFs seem to be missing > to...

delphi 7 Indy 9 and Indy 10
Hi, I can upgrade to indy 10 in delphi 7. But I have discover that indy 9 and Indy 10 have some different properties, so i had to change my old programs that were made in indy 9 to upgrade it to new version, but it is a long work. So I want to know if it is possible to install in the same delphi 7 both versions indy 10 and indy 9. I have tried to do it but i received a error message: Cannot load package 'IndySystem70'. It contains unit 'IdWinSock2', which is also contained in package 'Indy70'. Some can give me ideas or a link to read how to install both versi...

Indy E-Mail Problem (Indy 10, Delphi 2007)
Hello, we use Indy 10 with Delphi 2007 to get E-Mail using IMAP. We recieved an E-Mail which is not handled correctly. The E-Mail looks like this {code} Return-Path: <test@mail.com>; From: "Test Tester" <test@mail.com>; To: <test@mail.com>; Subject: Order Date: Wed, 7 Mar 2012 16:50:40 +0100 Message-ID: <15D526BEB8091D43859549D9E16E370FBA3123> MIME-Version: 1.0 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFk6K6fcF3...

Indy 10.6 compilation with Delphi 2009
With the current Subversion branch, the Delphi 2009 compiler shows these errors: C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(287) Error: E2137 Method 'GetSocketOption' not found in base class C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(289) Error: E2137 Method 'SetSocketOption' not found in base class C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(322) Fatal: F2063 Could not compile used unit 'IdIDN.pas' TIdStackWindows in System\IdStackWindows.pas, Lines 287 to 290: procedure GetSocketOption(ASocket: TIdStackSocketHandle; ALevel...

Migrating from Indy 9 to Indy 10
Hi... At work I had to update an old project and it is socket related. It was written with indy 9 and now all I have is Indy 10. I could install indy 9 but I'd rather make it work with I10. The problem is: In the server side there's a lot of: AThread.Connection.WriteInteger(1); AThread.Connection.WriteBuffer(XX, XX); AThread.Connection.ReadStream(XX, XX, XX); idTCPClient is widely used like this: TCPClient.WriteBuffer(Msg, sizeof(TMensaje)); TCPClient.ReadBuffer(Rta, sizeof(TRespuesta)); TCPClient.WriteStream(fStream); TCPClie...

Delphi 6 BDE/Indy 10 app crashes in Windows 2008?
I've got a user that reports my Delphi 6 BDE/Indy 10 app that crashes immediately after it is launched when being run on Windows 2008. I'm very puzzled as to why it happened as i had ported the application to work on Vista SP1 a few months ago (by creating the manifest) and thought that Vista and Windows 2008 are similar. As i do not have Windows 2008, I'm still trying to find more info from my user (from another country). Has anyone experience problems with Windows 2008? Thanks. :) <joshua lim> wrote in message news:94464@forums.codegear.com... > I've got ...

Ubuntu 10.10 on 10/10/10 at 10:10:10
Kinda neet. I imagine that time was UTC? Bill -- Bill_MI - Bill in Michigan Expert Opinions $20, Shut-Up $50 On Sun, 10 Oct 2010 17:28:14 -0400, Bill_MI wrote: > Kinda neet. I imagine that time was UTC? Released on 10/10/10, at 10:10:10?? We'll have to call this one Ubuntu Masonic! :-) Bill_MI wrote: > Kinda neet. I imagine that time was UTC? Installed last night on my testbed laptop. Installer is different from previous versions. Main improvement is that the bootloader installation is not hidden behind an Advanced button on the last screen. Early in th...

Indy 10 with Delphi 2010
I have been trying to figure out why my shift away from Delphi 6 and Indy 10 suddenly causes problems with my application. Indy developed further and is now in a release > 10.5 (Tiburon)...and the relase shipped with Delphi 2010 is buggy with repsect to using idFTP and downloading binary-files ex. ZIP.files. Everything worked fine in Delphi 6. I have now been reading the good answers given on this forum about shifting to Tiburon. But as I see it its stil in a transistion (nightly updates). And the insllation is for the very few... My question is there a version of Indy stil down...

Delphi 7 & Indy 10
I just installed Indy 10 in D7 all went fine until I attempted to compile and install the Supercore. When compiling IndySuperCore70.dpk got an error in IdFiber.pas Undeclared Identifier IfTrue, lines 227,228 & 352 also IfNotAssigned line 453. Don't think I'll need this package just wanted to pass the info on. Thanks, Don "Don Patrick" <donpatrick@cox.net> wrote in message news:159323@forums.codegear.com... > I just installed Indy 10 in D7 all went fine until I attempted to > compile and install the Supercore. Do not bother with SuperCore. ...

Delphi XE cannot compile Indy 10
I got a new development PC running Windiows 7. I cannot get Delphi 2006 to run on it (Registration problems) So I purchased Delphi XE. I expected problems compiling due to strings etc, but I did no expect problems with Indy10. ALL my programs use Indy10. I get this error, and I have absolutely no idea where to begin. In Unit IdWinsock2: function Stub_WSALookupServiceBegin(var qsRestrictions: {$IFDEF UNDER_CE}TWSAQuerySetW{$ELSE}TWSAQuerySet{$ENDIF}; const dwControlFlags: DWORD; var hLookup: THandle): Integer; stdcall; begin {$IFDEF UNICODE} @WSALookupServiceBegin := Fixu...

Delphi 7, INDY 10 and FastMM
Hi everybody, I installed a version from April 2010 of INDY 10. I use the latest version of FastMM4. I use Delphi 7 Enteprise. In the version of INDY 10 I used before I changed the units IdStack, IdThread and IDThread save to avoid memory leak messages from FastMM. After installing the new version of INDY10 I get the following errors: 1) I have to change the setting of the $G compiler option from OFF to ON. 2) After changing this I get an error that the another MemoryManager has been loaded and FastMM could not be used. Does anybody has an idea what has been changed and...

Indy 10 Delphi XE2 confusion
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_663cb.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" Updated "Chat 2.0" demo for Indy 10 in XE2. -- Remy Lebeau (TeamB) --JivePart=_663cb.zeB8CwDOH5aMJzMl Content-Type: application/x-zip-compressed; name="Chat.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Chat.zip" UEsDBBQAAAAAAAyxjD8AAAAAAAAAAAAAAAAQAAAAQ2hhdCAyLjAvQ2xpZW50L1BLAwQUAAAA...

Indy 10 Delphi XE2 confusion
I have just taken the plunge and updated from Delphi 5 to XE2. In D5 I have been happily using the ClientSocket and ServerSocket components to do some fairly basic TCP comms. I am now trying to understand how to do it using Indy 10. Unfortunately there seems to be very little in the way of examples and doco that is written for non gurus. Is there a huge demo folder somewhere that I have missed seeing? If I understand correctly there also seems to have been a change sometime during Indy 10 from Threads to Contexts. Most of the examples I have been able to find will not compile under XE2, even...

Web resources about - migrating from Delphi 6 With Indy 10 to XE7 with Indy 10 - embarcadero.delphi.winsock

Thunderclap Migrating From Twitter to Facebook
Thunderclap, a mass-messaging service that gained popularity on Twitter, has set its sights on Facebook . Twitter recently booted Thunderclap ...

Facebook Migrating Unofficial Page Fans to Official Pages at Brand Owner’s Request
Rupesh Mandal is such an avid fan of the Opera Mini web browser that he set up a Page on Facebook totally devoted to celebrating it, and then ...

YouTube - Evaluating & Migrating to Cloud Storage
Hochgeladen am 31.08.2011 When evaluating cloud storage, no matter the need, there are criteria that must be placed above the rest, including: ...

UAE is the global leader in attracting migrating professionals, study finds
... with 28 per cent, was the leading source of professionals, according to the LinkedIn study. The UAE is the global leader in attracting migrating ...

Enchanting video shows hundreds of stingrays migrating through shallow waters
A video showing hundreds of stingrays migrating through shallow waters&nbsp;has gone viral,&nbsp;months after being uploaded to Facebook.

The krilling season: Whales keep tourists migrating south
Earlybird whale watchers in Eden have been rewarded with astounding acrobatic displays in the bay.

Migrating Swans were bound for glory, says great
Migrating Swans were bound for glory, says great

Researchers say Irukandji jellyfish migrating further south along Qld coast
Researchers say climate change could be altering the migration patterns of the dangerous Irukandji jellyfish along Qld's east coast.

Apple chip supplier TSMC announces record profits, migrating to more advanced technology
... Company , iPhone , and iPad continue reading at 9to5Mac . What do you think? Discuss "Apple chip supplier TSMC announces record profits, migrating ...

More eBay Merchants Migrating to Amazon in Search of Sales Growth
EBay's once-loyal merchants are moving more of their business to Amazon, saying they get more for their money by selling merchandise via the ...

Resources last updated: 1/16/2016 8:32:43 AM