From: olegmad <ol...@ya...> - 2003-11-17 09:29:05
|
Hello! Peter, i take in response your wishes and encoded this email by UTF-8 :) I create table: CREATE TABLE "test" ( "unicode_fss" VARCHAR(5) CHARACTER SET UNICODE_FSS, "win1251" VARCHAR(5) CHARACTER SET WIN1251 ); Then i try execute code: string sql = "insert into \"test\" (\"unicode_fss\", \"win1251\") values (@unicodeValue, @win1251)"; FbCommand unicode_insert = new FbCommand(sql, connection, transaction); unicode_insert.Parameters.Add("@unicodeValue", FbDbType.VarChar).Value = "ÞÔÏÔÏ"; // string length = 5 unicode_insert.Parameters.Add("@win1251", FbDbType.VarChar).Value = "ÞÔÏÔÏ"; // string length = 5 unicode_insert.ExecuteNonQuery(); // Exception HERE!!! Exception: An unhandled exception of type 'System.InvalidOperationException' occurred in firebirdsql.data.firebird.dll Additional information: Invalid length of 10 bytes, max length allowed 5 bytes, for parameter @win1251 index 1 Why i can't post russian string with length 5 in field varchar(5)??? I know what russian char takes 2 bytes, but i thinking when i create varchar(5) - it means i can post in this field 5 char (independently of charset). When i use unicode_fss - all fine... Thanks. P.S. I attached full source code sample. begin 666 full_source.cs M=7-I;F<@4WES=&5M.PT*=7-I;F<@4WES=&5M+D1A=&$[#0IU<VEN9R!&:7)E M8FER9%-Q;"Y$871A+D9I<F5B:7)D.PT*#0IN86UE<W!A8V4@0V]N<V]L94%P M<&QI8V%T:6]N#0I[#0H)8VQA<W,@36%I;D-L87-S#0H)>PT*"0ES=&%T:6,@ M=F]I9"!-86EN*'-T<FEN9UM=(&%R9W,I#0H)"7L-"@D)"7-T<FEN9R!C;VYN M96-T:6]N4W1R:6YG(#T-"@D)"0E (D1A=&%B87-E/6,Z7'1E;7 N9V1B.R(@ M*PT*"0D)"2)5<V5R/5-94T1"03LB("L-"@D)"0DB4&%S<W=O<F0];6%S=&5R M:V5Y.R(@*PT*"0D)"2)397)V97(];&]C86QH;W-T.R(@*PT*"0D)"2)0;W)T M/3,P-3 [(B K#0H)"0D)(D1I86QE8W0],SLB("L-"@D)"0DB0VAA<G-E=#U5 M3DE#3T1%7T934SLB("L-"@D)"0DB<&]O;&EN9SUF86QS93LB("L-"@D)"0DB M4F]L93T[(CL-"@T*"0D)1F)#;VYN96-T:6]N(&-O;FYE8W1I;VX@/2!N97<@ M1F)#;VYN96-T:6]N*&-O;FYE8W1I;VY3=')I;F<I.PT*"0D)8V]N;F5C=&EO M;BY/<&5N*"D[#0H-"@D)"49B5')A;G-A8W1I;VX@=')A;G-A8W1I;VX@/2!C M;VYN96-T:6]N+D)E9VEN5')A;G-A8W1I;VXH*3L-"@T*"0D)<W1R:6YG('-Q M;" ](")I;G-E<G0@:6YT;R!<(G1E<W1<(B H7")U;FEC;V1E7V9S<UPB+"!< M(G=I;C$R-3%<(BD@=F%L=65S("A =6YI8V]D959A;'5E+"! =VEN,3(U,2DB M.PT*#0H)"0E&8D-O;6UA;F0@=6YI8V]D95]I;G-E<G0@/2!N97<@1F)#;VUM M86YD*'-Q;"P@8V]N;F5C=&EO;BP@=')A;G-A8W1I;VXI.PT*"0D)=6YI8V]D M95]I;G-E<G0N4&%R86UE=&5R<RY!9&0H(D!U;FEC;V1E5F%L=64B+"!&8D1B M5'EP92Y687)#:&%R*2Y686QU92 ]("+W\N[R[B([("\O('-T<FEN9R!L96YG M=&@@/2 U#0H)"0EU;FEC;V1E7VEN<V5R="Y087)A;65T97)S+D%D9"@B0'=I M;C$R-3$B+"!&8D1B5'EP92Y687)#:&%R*2Y686QU92 ]("+W\N[R[B([("\O M('-T<FEN9R!L96YG=&@@/2 U#0H)"0EU;FEC;V1E7VEN<V5R="Y%>&5C=71E M3F]N475E<GDH*3L-"@T*"0D)=')A;G-A8W1I;VXN0V]M;6ET*"D[#0H-"@D) @"6-O;FYE8W1I;VXN0VQO<V4H*3L-"@D)?0T*"7T-"GT` ` end |
From:
<car...@te...> - 2003-11-17 10:06:02
|
Hello: > Exception: > > An unhandled exception of type 'System.InvalidOperationException' occurred > in firebirdsql.data.firebird.dll > > Additional information: Invalid length of 10 bytes, max length allowed 5 > bytes, for parameter @win1251 index 1 I know this, i have the smae problem this weekend ;) it's changed already in the CVS for make the comparsion over the character count instead of the byte count. But with an example like there are problems too: 1. If i send the data encoded using the connection character set ( in this case UNICODE_FSS ) the win1251 value is going to give more bytes than the sqllen sent by the server for this field. 2. If i send the data using the field character set ( that is how it's in the CVS ) we are going to get te "Cannot transliterate characters between character sets". -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-17 12:24:15
|
> I know this, i have the smae problem this weekend ;) it's changed > already in the CVS for make the comparsion over the character count > instead of the byte count. > > But with an example like there are problems too: > > 1. If i send the data encoded using the connection character set ( in > this case UNICODE_FSS ) the win1251 value is going to give more bytes > than the sqllen sent by the server for this field. > > 2. If i send the data using the field character set ( that is how it's > in the CVS ) we are going to get te "Cannot transliterate characters > between character sets". So, you can't fix it?? It's firebird bug? |
From:
<car...@te...> - 2003-11-17 13:11:44
|
Hello: > So, you can't fix it?? It's firebird bug? I can tell that, can be a problem in how the .net provider is handling character sets ;). i have made a test for the point 1 by sending the complete set of bytes encoded with the connection character set and it raises an exception (operation was cancelled). Can be good to known opinion of Peter Jacobi on this case and probably can be good too, to post this case in the firebird-devel list. -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2003-11-17 17:15:19
|
Hello: Uh, this is bad :) : > I can tell that, it should be: I can't tell that ....... -- Best regards Carlos Guzmán Álvarez Vigo-Spain |