Bug 157822

Summary: BASIC: Strings are not limited to 64 000 characters, nor to ASCII, as declared in help
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: DocumentationAssignee: fpy
Status: RESOLVED FIXED    
Severity: normal CC: olivier.hallot
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: target:24.8.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 80430    

Description Mike Kaganski 2023-10-19 06:22:23 UTC
Dim Statement help page [1] tells:

> String: String variable consisting of a maximum of 64,000 ASCII characters.

This is not true: the strings can have up to almost 2^31 Unicode characters (strictly speaking, the current implementation, based on rtl::OUString, can hold up to 2 147 483 642 UTF-16 code units exactly).

[1] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03102100.html?DbPAR=BASIC
Comment 1 Mike Kaganski 2023-10-19 06:37:20 UTC
Oh, and I learned now, that since commit a44c9d023041c881f7858ddd9d93809dc1861313, on 64-bit systems, strings may safely contain exactly 2^31 - 1 = 2 147 483 647 characters. Not a huge difference, just getting more pedant points into karma :)
Comment 2 Commit Notification 2024-03-11 16:17:52 UTC
Pierre F committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/4e1458853a317d6efbc222e7719e06be10d98817

fix String limit  text/sbasic/shared/03102100 tdf#157822