[fpc-devel] TRegistry and Unicode

Michael Van Canneyt michael at freepascal.org
Wed Mar 13 18:51:29 CET 2019



On Wed, 13 Mar 2019, Bart wrote:

> On Mon, Mar 11, 2019 at 4:03 PM Michael Van Canneyt
> <michael at freepascal.org> wrote:
>
>> From my perspective: the public API is all that matters.
>> There I would opt for overloads that accept unicodestring.
>
> Done that.
> That was the easy part.
>
> Now:
> procedure GetKeyNames(Strings: TStrings);
> procedure GetValueNames(Strings: TStrings);
> procedure ReadStringList(const Name: String; AList: TStrings);
>
> AFAIK we do not have a TUnicodeStrings(List).
> Currently GetKeyNames and GetValueNames explicitely Utf8Encode the
> unicode (Utf16) result for that methods.
> Do I leave it like that?
>
> For ReadStringList an optional parameter (like: ForceUTF8:
> Boolean=False) can be added to control this behaviour.

I think this is the best.

What you could do is

TUniCodestringArray = Array of UniCodeString;

Function GetKeyNames : TUniCodestringArray;
Function GetValueNames : TUniCodestringArray;

The TStringList versions can call these and do the conversion.


> Delphi AFAIK does not have such a method, so Delphi compatibility is
> not an issue here.
>
> Opninions?
>
> Todo's for me:
> - the above
> - Make TXMLRegistry use UnicodeString
> - Things I forgot about
> - TRegIniFile: IMO don't change the API

Agreed.

Michael.



More information about the fpc-devel mailing list