Bug 132389 - BASIC: Replace is only case-insensitive for ASCII characters
Summary: BASIC: Replace is only case-insensitive for ASCII characters
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
Whiteboard: target:7.0.0
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
Reported: 2020-04-24 22:03 UTC by Mike Kaganski
Modified: 2021-03-15 12:39 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2020-04-24 22:03:18 UTC
> Sub TestReplace2
>   MsgBox Replace("АБВабв", "б", "*") ' test Cyrillic characters
>   MsgBox Replace("ABCabc", "b", "*") ' test ASCII characters
> End Sub

This code generates "АБВа*в" in the first case, while the correct result should be "А*Ва*в", since the default mode for Replace is case-insensitive [1]. It shows "A*Ca*c" correctly for the second case.

Replace should allow case-insensitive operation for non-ASCII characters, too.
Code pointer: SbRtl_Replace in basic/source/runtime/methods.cxx.

[1] https://help.libreoffice.org/6.4/en-US/text/sbasic/shared/replace.html
Comment 1 Commit Notification 2020-05-21 06:51:35 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":


tdf#132389 - case-insensitive operation for non-ASCII characters

It will be available in 7.0.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:

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