Subject Re: [Firebird-Architect] Re: [firebird-support] Writing UTF16 to the database
Author Jim Starkey
Lester Caine wrote:

>Jim Starkey wrote:
>
>
>
>>Claudio Valderrama C. wrote:
>>
>>
>>
>>>Olivier Mascia wrote:
>>>
>>>
>>>
>>>>String handling is handled using string classes.
>>>>
>>>>
>>>How do you allocate initial buffer for a string defined with length 20 in
>>>charactes that's going to be filled? Do you take an educated guess or do you
>>>take the worst case or do you go playing alloc-more-copy-and-dealloc-old
>>>until you have enough buffer while characters are written in the buffer?
>>>
>>>
>>String classes work on physical length.
>>
>>
>
>So would a UTF8 string be allocated 20 bytes, 60 or more :)
>
>
>
Strings are either handled by descriptor, which has the physical length,
or are assumed null terminated. User data is always passed by
descriptor because strings in the ODS are not null terminated. All
metadata strings are assumed null terminated.

JString (like the Microsoft CString) is set by assignment from either a
null terminated string or another JString (CString). Neither cares in
the least about the number of logical characters, nor should they.
Collation driven comparisons should be handled by higher level
facilities. The lower level string class is primarily concerned with
hold, passing, sharing, and deleting strings.

--

Jim Starkey
Netfrastructure, Inc.
978 526-1376