[fpc-devel] Unicode and UTF8String

Martin Friebe fpc at mfriebe.de
Mon Dec 1 13:54:22 CET 2008


Florian Klaempfl wrote:
> Felipe Monteiro de Carvalho schrieb:
>   
>> On Mon, Dec 1, 2008 at 10:13 AM, Florian Klaempfl
>> <florian at freepascal.org> wrote:
>>     
>>> No, it will be RTLString which type depends on the OS.
>>>       
>> Ok, so code would be something like this:
>>
>> var
>>   OSString: RTLString;
>>   MyString: UTF8String;
>> begin
>>   OSString := SomeRTLRoutine;
>>   MyString := OSString;
>>
>> ?
>>     
>
> Why would you do this and not
> MyString := SomeRTLRoutine;
> ?
>   
If I understand that right, this may cause some overhead, that in 
some(few) cases is not needed.

If I write an application using  stringtype "X" (WideString for 
example), then in the above "MyString" would be WideString.

The in/ouput for SomeRTLRoutine are RtlString, they are OS depended. If 
I compile for a OS using "UTF8" then that means for each and every call, 
it needs a string conversation.

Of course I understand, *if* some RTLFunction calls the OS, then the 
string must be converted. But if I simply want to extract the drive 
letter, or trim the path, and get the file name, without actually 
accessing the file or OS? Should it be possible to skip converting?

Best Regards
Martin



More information about the fpc-devel mailing list