#1 2017-10-11 11:31:07

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Customize UTF8ILComp

Hi,

the task is to create a none case sensitive custom collation for Hungarian. I thought it would be best  to create  a modified version of an existing function like UTF8ILComp, but looking at the implementation it is not obvious at which points  the extra code can be added.  If this approach is  good, it would probably be useful to document it in the source code.   

There are  two types of problems to solve:

1.Some accented characters like "ú" needs to be ordered after "u" but before "x" .
2. There are a few letters composed of two  or three characters eg "cs" which  needs to be ordered after "cz" and before "d". This requires access to the next two characters before making a decision.

Last edited by Leslie7 (2017-10-11 11:33:58)

Offline

#2 2017-10-11 12:52:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,706
Website

Re: Customize UTF8ILComp

I guess you expect the collation to be only at Sqlite3 level, right?
Then you can use TSQLRecordProperties.SetCustomCollation() with the expected collation function.

See https://synopse.info/files/html/Synopse … #TITLE_151

Offline

#3 2017-10-11 14:33:31

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Customize UTF8ILComp

That's the plan. smile But I need to create the  collation function for the native language to do that. I hoped that the easiest  and most optimized way would be to start with the current implementation  of UTF8ILComp and customize it. But it is not obvious how to do it. I assumed that this an issue with other locales as well, that is why I have asked for some general advice about tweaking the code.

Offline

#4 2017-10-11 16:26:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,706
Website

Re: Customize UTF8ILComp

See how SynSQLite3.pas implements its custom collations, and do the same.
Also check https://sqlite.org/c3ref/create_collation.html

Offline

Board footer

Powered by FluxBB