Bug 144245 - Unlike VBA, the 'Key' string parameter of the 'Add' method of the 'Collection' object, although case insensitive, is only for ANSII characters.
Summary: Unlike VBA, the 'Key' string parameter of the 'Add' method of the 'Collection...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.3.0 target:7.2.2 target:7.2.4
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 18:32 UTC by Igor
Modified: 2021-11-11 11:31 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor 2021-09-01 18:32:24 UTC
Description:
The heading reflects the problem.
The Collection object is not documented, but works well in native mode.

Steps to Reproduce:
1. Create an instance of the 'Collection' object.
2. Add two items to the collection using the key as non-ANSII characters, such 
   as "Д" and "д" (Cyrillic).
3. Sample code is shown below.

Actual Results:
Both items will be added without error.

Expected Results:
Duplicate key error should occur when adding the second item.


Reproducible: Always


User Profile Reset: No



Additional Info:
A similar problem:
https://bugs.documentfoundation.org/show_bug.cgi?id=132389

VBA code. Compare:

    Sub Test_Collection()
        Dim c As Collection, item

        On Error Resume Next
        Set c = New Collection
        c.Add 1, "D"
        c.Add 2, "d"
        c.Add 3, "Д"  'Cyrillic
        c.Add 4, "д"  'Cyrillic; for LibreOffice you have to set: UCase("д")
        On Error GoTo 0

        Debug.Print "Count: " & c.Count
        For Each item In c
            Debug.Print item
        Next
    End Sub

OUTPUT
Count: 2
1
3
Comment 1 Andreas Heinisch 2021-09-02 07:00:10 UTC
Confirmed in:

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 244891482469454ca186f5c81e23fd55c3b69ef5
CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL
Comment 2 Andreas Heinisch 2021-09-02 07:03:38 UTC
Code pointer for me:
https://opengrok.libreoffice.org/xref/core/basic/source/classes/sb.cxx?r=4dc40659#1985
Comment 3 Commit Notification 2021-09-07 07:52:42 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ef32c3b4f9b80918d6018e14297fa41245afd381

tdf#144245 - Case-insensitive operation for non-ASCII characters

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2021-09-07 11:47:28 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/463a1012c3e22ce40209b9fddd7cd5df4ae0870a

tdf#144245 - Case-insensitive operation for non-ASCII characters

It will be available in 7.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2021-09-07 18:53:10 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/092740eddd9d2e9b19e4c08f4980a59402e676e1

tdf#144245 - Added test file to automatic test

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2021-11-11 11:31:35 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/c0c9e86f6dd3f222eda468274ab8f4fdc760a1da

tdf#144245 - Added test file to automatic test

It will be available in 7.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.