BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Russian characters in Delphi 5

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internationalization
View previous topic :: View next topic  
Author Message
Hans Olav Stjernholm
Guest





PostPosted: Wed Jul 23, 2003 9:33 am    Post subject: Re: Russian characters in Delphi 5 Reply with quote



Hi again!

I've tried to set Charset to RUSSIAN_CHARSET, without any luck.
The characters are still replaced with question marks. This happens already
when I get the xml text from an xml node into a WideString. The WideString
is already with question marks.

It seems that Delphi doesn't really support unicode with WideStrings.
Because when I do the exact same thing in C# and .Net (using the msxml4) the
characters come out ok.
To me it seems as if the delphi compiler between the lines converts the
widestring given from the xml node into a ansistring, and then converts this
ansistring into a WideString, or something like that...

Any ideas?


Back to top
Maris Janis Vasilevskis
Guest





PostPosted: Wed Jul 23, 2003 11:38 am    Post subject: Re: Russian characters in Delphi 5 Reply with quote



Hans Olav Stjernholm wrote:
Quote:
I've tried to set Charset to RUSSIAN_CHARSET, without any luck.
The characters are still replaced with question marks. This happens already
when I get the xml text from an xml node into a WideString. The WideString
is already with question marks.


Are you sure? Maybe you convert the WideString into AnsiString during viewing?

Mahris


Back to top
FL
Guest





PostPosted: Wed Jul 23, 2003 11:44 am    Post subject: Re: Russian characters in Delphi 5 Reply with quote



Oops, I meant you're not handling the WideString->AnsiString conversion
properly.

Francisco

FL wrote:
Quote:

I guess you're now displaying the strings properly.

Francisco

Back to top
Hans Olav Stjernholm
Guest





PostPosted: Thu Jul 24, 2003 9:30 am    Post subject: Re: Russian characters in Delphi 5 Reply with quote

Thanks a lot!

I'll try out your function from the Jedi Code...

"Bernhard Geyer" <Bernhard.Geyer (AT) docware (DOT) de> wrote

Quote:

"Hans Olav Stjernholm" <none (AT) no (DOT) no> schrieb im Newsbeitrag
news:3f1e557a (AT) newsgroups (DOT) borland.com...
Hi again!

I've tried to set Charset to RUSSIAN_CHARSET, without any luck.

You must convert the Widestring to the correct Codepage bevor assigning it
to
the VCL-Control:

This function form Jedi Code Library (JclUnicode.pas) will help:

function WideStringToStringEx(const WS: WideString; CodePage: Word):
string;
var
InputLength,
OutputLength: Integer;
begin
InputLength := Length(WS);
OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS),
InputLength, nil, 0, nil, nil);
SetLength(Result, OutputLength);
WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength,
PChar(Result), OutputLength, nil, nil);
end;

The characters are still replaced with question marks. This happens
already
when I get the xml text from an xml node into a WideString. The
WideString
is already with question marks.

The Delphi-IDE doesn't support widestrings. So if you want to watch a
widestring
with some special characters, you have to do followin:

Ord(MyWideString[PositionToInspect])

if "63" -> Widestring has a converted string in it
if > 127 -> Widestring is ok. No Codepage-Conversion is done.

It seems that Delphi doesn't really support unicode with WideStrings.

It does. But Delphi-IDE doesn't. We have ported our application to unicode
with only some problems (most of them where Windows-Bugs) ans support
unicode
from Win95-2003.

Because when I do the exact same thing in C# and .Net (using the msxml4)
the
characters come out ok.
To me it seems as if the delphi compiler between the lines converts the
widestring given from the xml node into a ansistring, and then converts
this
ansistring into a WideString, or something like that...

This conversion is only done if you assign a widestring to a string or a
string to a widestring.
The conversion is done with the current codepage.

Best regards

Bernhard





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internationalization All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.