var
wString: wideString;
nString: string;
begin
nString := 'hello';
wString := nString;
end;
works fine UNLESS the nString is greater than 4096 characters, in
which case the assignment to wString results in a empty string.
Sean
What version of Delphi?
I have seen other problems with explicit conversion from WideString to
string, such as in: DoSomething([string(OneHelluvaWideString))]).
When the called function uses "array of const", and you include an
explicitly converted WideString as part of the array, all kinds of trouble
may occur - memory corruption, invalid string ref-counts etc. I've only
seen this happen in Delphi 5.0 though.
- M.m.
I'm using Delphi 5. I'm thinking it has more to do with a COM
limitation than a Delphi limitation because the WideString I was
assigning to was a parameter in a COM call.
Sean
Funny you say that, because the WideString in my case was also coming from
a COM call (this was in a server-app).
My solution, anyways, was simply to drop the explicit conversion, and let
Delphi do the conversion automagically.
- M.m.