@@ -1246,7 +1246,7 @@ protected void WriteRawParameter(IXdrWriter xdr, DbField field)
12461246 else
12471247 {
12481248 var svalue = field . DbValue . GetString ( ) ;
1249- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1249+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
12501250 {
12511251 throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
12521252 }
@@ -1271,7 +1271,7 @@ protected void WriteRawParameter(IXdrWriter xdr, DbField field)
12711271 else
12721272 {
12731273 var svalue = field . DbValue . GetString ( ) ;
1274- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1274+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
12751275 {
12761276 throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
12771277 }
@@ -1394,7 +1394,7 @@ protected async ValueTask WriteRawParameterAsync(IXdrWriter xdr, DbField field,
13941394 else
13951395 {
13961396 var svalue = await field . DbValue . GetStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
1397- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1397+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
13981398 {
13991399 throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
14001400 }
@@ -1419,7 +1419,7 @@ protected async ValueTask WriteRawParameterAsync(IXdrWriter xdr, DbField field,
14191419 else
14201420 {
14211421 var svalue = await field . DbValue . GetStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
1422- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1422+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
14231423 {
14241424 throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
14251425 }
@@ -1533,7 +1533,7 @@ protected object ReadRawValue(IXdrReader xdr, DbField field)
15331533 {
15341534 var s = xdr . ReadString ( innerCharset , field . Length ) ;
15351535 if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 &&
1536- s . Length > field . CharCount )
1536+ s . RuneCount ( ) > field . CharCount )
15371537 {
15381538 return s . Substring ( 0 , field . CharCount ) ;
15391539 }
@@ -1630,7 +1630,7 @@ protected async ValueTask<object> ReadRawValueAsync(IXdrReader xdr, DbField fiel
16301630 {
16311631 var s = await xdr . ReadStringAsync ( innerCharset , field . Length , cancellationToken ) . ConfigureAwait ( false ) ;
16321632 if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 &&
1633- s . Length > field . CharCount )
1633+ s . RuneCount ( ) > field . CharCount )
16341634 {
16351635 return s . Substring ( 0 , field . CharCount ) ;
16361636 }
0 commit comments