Re: Idftp.Put utf8 problem

Giganews Newsgroups
Subject: Re: Idftp.Put utf8 problem
Posted by:  explorer (explorer.…@Gmail.com)
Date: Tue, 02 Jun 2009

I checked the stack, it actions in this way:

TIdFTP.Put(...)
  |
TIdFTP.InternalPut
  |
TIdIOHandler.WriteLn
  |
TIdIOHandler.Write('STOR 新建 Microsoft Excel 工作表.xls'#$D#$A,nil)
  |
  |
ToBytes('STOR 新建 Microsoft Excel 工作表.xls'#$D#$A,-1, 1, $2B117F0)

    Result := TIdTextEncoding.Convert(
      Indy8BitEncoding,
      AEncoding,
      RawToBytes(AValue[AIndex], LLength));

  |
  |
TIdTextEncoding.Convert($2AFDB14, $2B117F0, (83,84,79,...))

  ADestination.GetBytes(ASource.GetChars(ABytes));
  |
  |
TIdTextEncoding.GetChars
  |
TIdTextEncoding.GetChars
  |
TIdMBCSEncoding.GetChars($2B1248C, 38, '', 38)

  Result := MultiByteToWideChar(FCodePage, FMBToWCharFlags,
PAnsiChar(Bytes), ByteCount, Chars, CharCount);

....

Here INDY used winapi to map characterstring to a unicodestring, BUT the
FCodePage is always 28591(ISO 8859-2 Central Europe). Infact the
characterstring is in Chinese, so the convertion is fault.

Indy8BitEncoding is Created by TIdTextEncoding.GetEncoding(28591), Why
INDY always use Indy8BitEncoding as ASource when Convert? How can I
solve the problem?

Replies

In response to

Idftp.Put utf8 problem posted by explorer on Tue, 02 Jun 2009