Message 'malformed string'  appear instead of 'expected length 8191, actual 
NNNN' when trying to generate UTF8 multi-byte chars with char_length >= 10922
---------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4894
                 URL: http://tracker.firebirdsql.org/browse/CORE-4894
             Project: Firebird Core
          Issue Type: Bug
          Components: Charsets/Collation, Engine
    Affects Versions: 3.0 RC 1
         Environment: LI-V3.0.0.31981 (64 bit)
WI-V3.0.0.31981(32 bit)
            Reporter: Pavel Zotov


Script for running on Windows (replace port and path + database file with your 
env.):
===
set names utf8;
set list on;
shell del C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb 2>nul;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' 
default character set utf8;
commit;

set list on;
out nul;
select rpad('', 10921,'∏Ω∑') as multi_byte_10922 from rdb$database;
select rpad('', 10922,'∏Ω∑') as multi_byte_10922 from rdb$database;
out;
quit;
===

Similar script for running on Linux:
===
set names utf8;
set list on;
shell rm -f /var/db/fb30/c4881.fdb 2>nul;
create database 'localhost/3333:/var/db/fb30/c4881.fdb' default character set 
utf8;
commit;

set list on;
out /dev/null;
select rpad('', 10921,'∑∏Ω') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∑∏Ω') as multi_byte_10922 from rdb$database;
out;
quit;
===

Result in any case will be:
===
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8191, actual 10921

Statement failed, SQLSTATE = 22000
Malformed string
===

IMHO, second expression (which tries to do RPAD up to 10922 should raise the 
same exception as first one, no matter of its argument.

PS.

All three characters in the padded string '∑',  '∏'  and 'Ω' -- requires three 
byte for encoding. Symbol '∏' should not be confused with cyrillic upper 'Pe', 
it is mathematical sign of number producing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to