cancel
Showing results for 
Search instead for 
Did you mean: 

Non-ASCII characters are garbled in remote procedure call

1,055

I have a Procedure like this:

ALTER PROCEDURE "appblddbo"."PRC_TestNVarchar"( )
RESULT( TheText NVARCHAR(4000))
BEGIN
  DECLARE LOCAL TEMPORARY TABLE Result
  (
    TheText NVARCHAR(4000)
  );
  INSERT INTO Result VALUES('Starém');
  SELECT * FROM Result;
END

If I call it locally the text is returned correctly.

On a remote server this procedure is created as a remote procedure using an ODBC data source:

ALTER PROCEDURE "appblddbo"."PRC_TEST_REMOTE"()
result( "TheText" nvarchar(4000) ) 
at 'RemoteDB;;appblddbo;PRC_TestNVarchar'

If I call the remote procedure the result is garbled as

Star�

If I use the ODBC data source to connect the "local" database directly, executing the procedure gives the correct result.

Database version is 17.0.10.5820 on the "local" side and 17.0.11.6933 on the "remote" side. I'd like to avoid upgrading the local database if possible.

Settings for both databases:

  • CHAR collation Sequence: 1252LATIN1
  • CHAR character encoding: windows-1252
  • CHAR case sensitivity: Ignore
  • NCHAR collation sequence: UCA
  • NCHAR character set encoding: UTF-8
  • NCHAR case insensitivity: Ignore

The result does not change when changing the literal expression in the procedure to "N'Starém'" or "UNISTR(N'Starém')". Since é is part of windows-1252 IMHO it should be converted to NCHAR correctly, or am I missing something?

Applying UNISTR to the remote result leads to a (probably) infinite loop.

Can anyone give me a hint what I am doing wrong? Can this be an ODBC problem? Or better to look at some database settings?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

According to Release Notes this seems to be fixed bug in EBF Build 7181:

================(Build #7181  - Engineering Case #827221)================

The result from a remote procedure that returns an NCHAR, NVARCHAR, LONG 
NVARCHAR, etc. column is not returned to the local server correctly.  The 
nchar data values are garbled.

Example:

forward to RemoteSA;
create or replace procedure P_nvarchar()
result( TheText nvarchar(250) )
begin
    select unistr('To infinity and \\u2135\\u2080');
end;
forward to;
create or replace procedure P_nvarchar_et()
result( TheText nvarchar(250) )
at 'RemoteSA;;;P_nvarchar';
select TheText from P_nvarchar_et();

This problem has been fixed. Now a remote procedure result is handled in 
the same way the result from a remote table is handled.

Note that I have not verified this yet...