Reproduceable unicode bug
Anu de Deus
Hampshire, UK
When accessing a variable value from the script, which holds a Russian string, the value is ok if you read it directly.
But if you pass it as a parameter to a function inside the same script, it loses its widestrings capabilities and the result is a widestring to ansistring conversion gone wrong.
Try this (or simply open my attached report sample):
Create a new form, just drop a FRXreport and frxDesigner on it, open the report designer.
Add a variable (named 'var1'), which holds a Russian word, like 'Умолчание'. And a memoview object on the page. Added a onbeforeprint event in the script, like this:
Clearly, to me, the function call is unable to keep the widestring value internally. As far as I know, that's the only problem with unicode in my entire report/application.
Please note that my Vista 32 bits has the Russian language installed, but the Windows setting for 'Language for non-unicode programs' is English. I need to keep it this way as that's what my customers have. In any case, a true widestrings/Unicode application should not need this to be changed (like a FR app).
I got the latest FR daily build, 4.10.6, and Delphi 2010.
If you cannot reproduce the error, please set your 'Language for non-unicode programs' to English and verify (after rebooting).
Does anyone else have this problem, and know a work around it?
(I opened a support ticket for this, but so far, no replies)
Thanks in advance,
Alex
But if you pass it as a parameter to a function inside the same script, it loses its widestrings capabilities and the result is a widestring to ansistring conversion gone wrong.
Try this (or simply open my attached report sample):
Create a new form, just drop a FRXreport and frxDesigner on it, open the report designer.
Add a variable (named 'var1'), which holds a Russian word, like 'Умолчание'. And a memoview object on the page. Added a onbeforeprint event in the script, like this:
function GetParameterFromSender: string;
begin
  result := get('var1'); Â
end;
procedure memo1OnBeforePrint(Sender: TfrxComponent);
var                                                               Â
  lStr1, lStr2 : string;
begin
    lstr1 := GetParameterFromSender;
    lstr2 := get('var1');
// lstr1 now has '??????????', because it called GetParameterFromSender to get the value.
// lstr2 now has 'Умолчание', as it used get() directly
    showmessage(lStr1);
    showmessage(lstr2);
end;
begin
end.
Clearly, to me, the function call is unable to keep the widestring value internally. As far as I know, that's the only problem with unicode in my entire report/application.
Please note that my Vista 32 bits has the Russian language installed, but the Windows setting for 'Language for non-unicode programs' is English. I need to keep it this way as that's what my customers have. In any case, a true widestrings/Unicode application should not need this to be changed (like a FR app).
I got the latest FR daily build, 4.10.6, and Delphi 2010.
If you cannot reproduce the error, please set your 'Language for non-unicode programs' to English and verify (after rebooting).
Does anyone else have this problem, and know a work around it?
(I opened a support ticket for this, but so far, no replies)
Thanks in advance,
Alex