Migrating from Delphi 2007 to XE with Unicode strings

Hi,

I have a RemObjects service which accepts AnsiStrings for several methods. I’ll like to migrate to Delphi XE using Unicode.
My problem is that several customers will continue using the old Delphi 2007 application.

Do I have to create new methods for the Unicode version or the old client will be able to connect to the new server?
I know that all parameters are serialized in the client according to the interface it was using, but maybe, … being strings, they could be implicitly converted back and forth (even losing information) as required.

Best Regards,

David Izada R

Hi.

The most obvious solution - use two server with different ports. Also you can use SOAP message, it doesn’t distigniush ansi and unicode string.

David - your service will keep working as is, but if your methods are defined to use AnsiString in the rodl, then the strings WILL be marshalled as ansi, and if users enter Unicode data in your client, it will be down-converted, and some extended chars will be lost (just as they always would have, really, if your clients were on a different code page than your server)

One thing that MIGHT be safe, depending on the kind of data you send, is to change your service to use UTF8 strings. Those are wire compatible with ANSI ones (ie old clients keep working), but when you call them from Unicode Delphi, any unicode chars will be properly encoded. The problem might be if users from your old app send strings that are ANSI with characters that break when treated as Unicode.

The SAFEST solution would be to create a second copy of your service (could be just a new service defined in the same rodl), and define the methods as UTF8 (or wide string, makes no conceptual difference, UTF8 is smaller on the wire, for most languages). Have your new app call this, and adjust the old service on the server to just pass the strings to the new one.

hth,
marc