If I remember well, type alias cause problems with event handlers. To be 
tested.
WideString have a performance hit.
Not many people will still use pre-D2009 compiler to really support 
international charset more than now (for example for french, unicode is 
defenitely not needed). I think it is better to make the most efforts on 
those users not willing to upgrade and makes things the most easier possible 
for D2009 and up. My solution is the best in that regards. If one has to 
port an old application, either he has nothing to do if he previously dodn't 
support international characters or he has to write null convertion routines 
so that the nullify their conversions.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


----- Original Message ----- 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Sunday, August 24, 2008 10:10 AM
Subject: Re: [twsocket] FTP and Utf-8 in ICSv7


> Francois PIETTE wrote:
>> Before D2009, the user will have to add code to encode their
>> international characters in UTF8 and the component will have to have
>> code to handle it properly.
>>
>> In the component code, you'll have conditional compilation for
>> handling string properties which have a need for international
>> charset.
>
> Use of a type alias would avoid conditional compilation by one
> declaration "UnicodeString = WideString" for pre-D2009 compilers.
> The components and user applications would the become 100% compatible
> from D7 to D2009.
>
>> For example a filename in the FTP component. Assuming FTP
>> protocol want UTF8 string, then when compiled with D2009 and up, the
>> component will convert unicode string (UTF-16) to UTF-8 before
>> sending down to the wire. When compiled with pre-D2009, the component
>> will simply takes the string as an UTF-8 string and send it as is.
>
> Don't forget file system API functions they have to be called with
> a PWideChar path or file name argument anyway, so the UTF-8 string
> always has to be converted to WideString first which would add plenty
> of IFDEFs, making the code less readable. Those conversions are not
> required if we used WideString from the beginning.
>
>> At the application level, let's assume the application has a TEdit to
>> enter a file name. With D2009 and up, there is nothing to do, just
>> pas the text value (UTF-16 !) to the component. With pre-D2009, the
>> application developer will need to use a unicode enabled TEdit (not
>> provided with Delphi !), convert the text value to UTF-8 and feed the
>> FTP component property with it.
>
> Even in D7 you can assign a WideString to, for instance, a TEdit.Txt,
> the conversion is done in the background using current default system
> code page. Of course characters that cannot be converted will be shown
> as "?". However if you use, for instance the TNT Unicode controls
> even Chinese file names are displayed properly.
>
>>
>> Isn't it too simple ? Did I miss something ?
>
> I think it is more complicated, no clean solution and confusing.
>
> --
> Arno Garrels
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to