Re: ExtListItem returns corrupted facts

Giganews Newsgroups
Subject: Re: ExtListItem returns corrupted facts
Posted by:  Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)
Date: Sat, 15 Jan 2011

"jvlad" <dm…@yandex.ru> wrote in message
news:9724BC9AD0CDE340dm…@yandex.ru...

> Unfortunately, the followed call to IdFTPListParseBase.ParseListing()
> does not know about it, and passes the string through TId8BitEncoding
> and TUTF8Encoding

That is a short-term patch to a much larger problem affecting all directory
listings in general - the ability to detect and handle charsets correctly
across the board.

An alternative solution that has been suggested to us earlier is to have
List() store the raw listing data as-is, such as changing the
TIdFTP.ListResult property into a TStream or TIdBytes instead of being a
TStrings, and then let the individual parsers handle charset decoding
internally as needed.

Another option I can think of now, and probably a better one, is to have
ExtListItem() (and ExtListDir()) force TId8BitEncoding be used instead of
TUTF8Encoding when receiving the raw listing data, regardless of whether
UTF-8 is enabled or not.  That way, the resulting UnicodeString that
ParseFactsMLS() receives as input would contain characters in the 8bit
range, and the UTF16->8bit conversion would be a no-op so the UTF-8 octets
can be decoded correctly.

--
Remy Lebeau (TeamB)

Replies

In response to

ExtListItem returns corrupted facts posted by jvlad on Sat, 15 Jan 2011