Malformed string when trying to cast text containing national (cyryllic) 
characters  to UTF8 if field was created in charset = NONE
-----------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-3830
                 URL: http://tracker.firebirdsql.org/browse/CORE-3830
             Project: Firebird Core
          Issue Type: Bug
          Components: Charsets/Collation
    Affects Versions: 2.5.1
            Reporter: Pavel Zotov


C:\MIX\firebird\misc>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'tcs2.fdb'; commit;
SQL> show database;
Database: tcs2.fdb
        Owner: SYSDBA
PAGE_SIZE 4096
Number of DB pages allocated = 196
Sweep interval = 20000
Forced Writes are ON
Transaction - oldest = 3
Transaction - oldest active = 4
Transaction - oldest snapshot = 4
Transaction - Next = 5
ODS = 11.2
Default Character set: NONE
SQL> select a.mon$character_set_id cset_id,c.rdb$character_set_name cset_name
CON> from mon$attachments a
CON> left join rdb$character_sets c on 
a.mon$character_set_id=c.rdb$character_set_id
CON> where a.mon$attachment_id=current_connection;

CSET_ID CSET_NAME
======= 
===============================================================================
      0 NONE

SQL> recreate table ttt_none(msg varchar(60)); commit;
SQL> insert into ttt_none values('some message'); commit;
SQL> select cast(msg as varchar(60) character set utf8) msg from ttt_none;

MSG


===============================================================================
some message



SQL> insert into ttt_none values('некоторое сообщение'); commit; -- some text 
in russian here
SQL> select cast(msg as varchar(60) character set utf8) msg from ttt_none;

MSG


===============================================================================
some message


Statement failed, SQLSTATE = 22000
Malformed string
SQL>


But:
-----
SQL> select cast(msg as varchar(60) character set win1251) msg from ttt_none;

MSG
============================================================
some message
некоторое сообщение -- is extracted OK and seems readable.

------------
PS.

SQL> show version;
ISQL Version: WI-V2.5.1.26351 Firebird 2.5
Server version:
Firebird/x86/Windows NT (access method), version "WI-V2.5.1.26351 Firebird 2.5"
Firebird/x86/Windows NT (remote server), version "WI-V2.5.1.26351 Firebird 
2.5/XNet (CSPROG)/P12"
Firebird/x86/Windows NT (remote interface), version "WI-V2.5.1.26351 Firebird 
2.5/XNet (CSPROG)/P12"
on disk structure version 11.2

PPS. 
The RDB$EXCEPTION table contains field RDB$MESSAGE that is created in charset = 
NONE.
Is it correct  ?

-- 
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

       

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to