Description: I personally prefer to have an english user interface, while still being able to view values with localized formatting. This combination allowed me to stumble across the issue described below. - menu / tools / options / languages and locales / general With single and double values, it is possible to produce localized strings, and then reparse the original value from it. That however is no longer possible with currency values. - x=CSng(1.5) : s=CStr(x) : y=CSng(s) '(y = x) is true - x=CDbl(1.5) : s=CStr(x) : y=CDbl(s) '(y = x) is true - x=CCur(1.5) : s=CStr(x) : y=CCur(s) 'CCur(s) throws an ERROR For currency values, CStr(x) seems to produce culture invariant output (with "." as decimal separator, instead of "," as configured by my locale settings). That is in contrary to CStr(x) for single or double values. Thus far, that behavior didn't seem to be much of an issue since CCur(s) was still able to reproduce the orginal currency value. However, some time after LibreOffice version 24.2.5.2 the behavior of CCur(s) must have been changed such that it now needs localized input to work. As a consequence, CStr() and Format() may produce output that CCur() fails to process. VERSION: 24.8.0.3 (X86_64) / LibreOffice Community LOCALE: de-DE (en_US.UTF-8); UI: en-US SYSTEM: AppImage on Linux - locale settings: english interface, german formatting - CStr(value) produces "1.5000" - ERROR, should be localized - Format(value, "General Number") - same result - CCur("1.5000") produces an "inadmissible value" error - ERROR - CCur("1,5") will return CCur(1.5) - THE ISSUE VERSION: 7.3.7.2 / LibreOffice Community LOCALE: de-DE (en_US.UTF-8); UI: en-US SYSTEM: Preinstalled on Linux Mint - locale settings: english interface, german formatting - CStr(value) produces "1.5000" - ERROR, should be localized - Format(value, "General Number") - same result - CCur("1.5000") does work - CCur("1,5") will return CCur(15) VERSION: 24.2.5.2 (X86_64) / LibreOffice Community LOCALE: de-DE (de_DE); UI: de-DE SYSTEM: Windows 10 on a virtual machine - locale settings: german interface, german formatting - CStr(value) produces "1.5000" - ERROR, should be localized - Format(value, "General Number") - same result - CCur("1.5000") does work - CCur("1,5") will return CCur(15) SUMMARY - CStr() and Format() will consistently produce localized output with single and double values. - CSng() and CDbl() allow reproduce the original value from localized representations (round-trip is possible). - CCur() now seems to expect localized input, which CStr() will not produce for currency values. - CStr() and Format() continue to ignore locale settings for currency values (round-trip is broken). POSSIBLE FIX Change CStr() and Format() such that both produce localized output for currency values. This would re-enable round-trip conversions. Furthermore, these functions whould then show consistent behavior across single, double and currency values. Steps to Reproduce: As layed out in the description, and in the attached sample code. Actual Results: It is no longer possible to format a currency value using the CStr() or Format() function, and then expect CCur() to always reproduce the original value. Expected Results: A round-trip (format and reparse the original value) should always be possible. Furthermore, if CStr() produces localized output for single or double values, then - as a matter of consistency - CStr() should also produce localized output for currency values. Reproducible: Always User Profile Reset: No Additional Info: Version: 24.8.0.3 (X86_64) / LibreOffice Community Build ID: 0bdf1299c94fe897b119f97f3c613e9dca6be583 CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: de-DE (en_US.UTF-8); UI: en-US Calc: threaded
Created attachment 196133 [details] Some sample code to reproduce the issue
The change happened in commit 9cc8457abcae57c7f9de6e0fbca1fbc2a0cc9892 (tdf#128122 Updated BASIC CCur to reuse SvNumberFormatter).
Code pointer: ImpCurrencyToString in https://opengrok.libreoffice.org/xref/core/basic/source/sbx/sbxcurr.cxx?r=9cc8457a&mo=1186&fi=ImpCurrencyToString#ImpCurrencyToString cf. to ImpCvtNum in https://opengrok.libreoffice.org/xref/core/basic/source/sbx/sbxscan.cxx?r=1ecde0f5&fi=ImpCvtNum#ImpCvtNum
https://gerrit.libreoffice.org/c/core/+/172693
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a795fddafad69e8a7ce600352c7236b35539cebb tdf#162724: use localized decimal separator in ImpCurrencyToString It will be available in 25.2.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.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-24-8": https://git.libreoffice.org/core/commit/74a68f76bb116e348826bff912d52d8205ab92a3 tdf#162724: use localized decimal separator in ImpCurrencyToString It will be available in 24.8.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.