On 26/07/2016 08:00, Adriano dos Santos Fernandes wrote:
> On 26/07/2016 02:49, Geoff Worboys wrote:
>>> Internally the parameter is WIN1252 (length of 'á' = 1) even the
>>> connection charset being UTF8 (where length would be 2).
>> Can you find a way to try the equivalent of this:
>>
>> EXECUTE BLOCK (
>>     i VARCHAR(60) CHARACTER SET WIN1252 = ?
>> ) RETURNS (
>>     r VARCHAR(60) CHARACTER SET WIN1252
>> ) AS
>>     DECLARE v VARCHAR(60) CHARACTER SET UTF8;
>> BEGIN
>>   v = _utf8 x'C3A1';
>>   i = v;
>>   r = v;
>>   r = 'i=' || Octet_Length(i) || '  v=' || Octet_Length(v) || '  r=' || 
>> Octet_Length(r);
>>   SUSPEND;
>> END
>>
>>
>> Note that _utf8 x'C3A1' == 'á'.
>>
>>
>> Here under an IBObjects based client I get:
>>
>> UTF8 connection   : i=2  v=2  r=1
>> WIN1252 connection: i=1  v=2  r=1
>>
>>
>> Under a Jaybird based client I get: i=2  v=2  r=1
>> for all connections, even when I try to say use encoding WIN1252
>> (but I'm not all that familiar with the client so may be doing
>> something wrong).  Whatever, that "i=2" is wrong.
>>
>> But I can't work out how to try this in isql.
>>
> With FB 3 snapshot with both charsets:
>
> i=1  v=2  r=1
>
> Seems right.
>
> I do not know what these tools are doing differently.
>
>
My test is a bit different as bulk_insert cannot be used with output
parameters. Here is it:

set bulk_insert EXECUTE BLOCK (
    i VARCHAR(60) CHARACTER SET WIN1252 = ?
) AS
    declare r VARCHAR(60) CHARACTER SET WIN1252;
    DECLARE v VARCHAR(60) CHARACTER SET UTF8;
BEGIN
  v = _utf8 x'C3A1';
  i = v;
  r = v;
  r = 'i=' || Octet_Length(i) || '  v=' || Octet_Length(v) || '  r=' ||
Octet_Length(r);
  exception ex r;
END!
('a')

Maybe the test can be done with EXECUTE STATEMENT 'EXECUTE BLOCK ...' too...


Adriano


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to