Bug 104904 - Firebird: Function LEFT gives wrong count with special characters
Summary: Firebird: Function LEFT gives wrong count with special characters
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-24 10:29 UTC by Robert Großkopf
Modified: 2017-02-01 18:50 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Open query "Left" - shows wrong number of characters for fields with special characters. (3.94 KB, application/vnd.oasis.opendocument.database)
2016-12-24 10:29 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2016-12-24 10:29:32 UTC
Created attachment 129916 [details]
Open query "Left" - shows wrong number of characters for fields with special characters.

Open the attached database.
Open the query "Left".
The content of the field "Name" is set to LEFT("Name",3)
Shows only the first two characters, if the "Name" has special characters at the beginning of "Name".
SELECT "Name", LEFT("Name", 3) FROM "Table"
gives 
Bülgin | Bü
Gloria | Glo
Örtchen | Ör

Works right with HSQLDB, wrong with Firebird.

Tested with
Version: 5.4.0.0.alpha0+
Build ID: 2a4cd80abcf9e515d1ce3b3a944b573bdc42bff2
CPU Threads: 4; OS Version: Linux 4.1; UI Render: default; VCL: kde4; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-12-22_00:18:04
Locale: de-DE (de_DE.UTF-8); Calc: group
Comment 1 Robert Großkopf 2016-12-24 11:08:36 UTC
It's the same behavior with the function "Right".
RIGHT('Größe',3)
gives
'ße'
RIGHT('Größe',4)
gives
'�ße'
- an undefined character, because with UTF8 there will only be read "half" of 'ö'.

All tested with OpenSUSE 42.1 64bit rpm Linux.
Comment 2 Robert Großkopf 2016-12-26 11:05:46 UTC
Ans also the same behavior with every character-function, which depends on the length of a string.

Start tools > SQL
Copy the following code and execute it:
select char_length(_iso8859_1 'Grüß di!') from "Table1"

Should return 8, but iso8859_1 isn't installed:

firebird_sdbc error:
*CHARACTER SET ISO8859_1 is not installed
caused by
'isc_dsql_prepare'

Counting of characters should work in every language - not only in English. Without this function most of the character-functions are unusable for people, who use special characters as there native language.
Comment 3 Buovjaga 2017-01-03 16:46:08 UTC
Confirmed.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha0+
Build ID: fc0d4e6bc43d5f982452df07930f5ecf5927ad22
CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on December 31st 2016
Comment 4 Robert Großkopf 2017-02-01 18:47:58 UTC
Resolved with https://bugs.documentfoundation.org/show_bug.cgi?id=105142

Could confirm with LO 5.4.0.0 from 01-02-2017