13.10.2011 9:13, Hans-Peter Diettrich wrote:
Sven Barth schrieb:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/inc/astrings.inc?revision=19444&view=markup


I don't understand the use of encoding 0 and CP_NONE in FPC. Can
somebody explain?

DefaultSystemCodepage is used When the paticular encoding must be known both for 0 and CP_NONE codepages.

Furthermore I suspect that the implementation of

Function Pos(Const Substr : RawByteString; Const Source : RawByteString)
: SizeInt;

is wrong. The comparison must take into account the encodings of both
strings.


Function Pos(c : AnsiChar; Const s : RawByteString) : SizeInt;
is questionable at all, when the encoding of the arguments is unknown or
ignored (as is).

Did you run some tests in delphi for these functions?

Please run the next program to be sure:

{$apptype console}

type
  T866Sting = type AnsiString(866);
  T1251String = type AnsiString(1251);
var
  s866: T866Sting;
  s1251: T1251String;
begin
  s866 := 'привет';
  writeln(s866);
  s1251 := 'рив';
  writeln(s1251);
  writeln(pos(s1251, s866));
end.

I have the bad impression that the implementors didn't understand the
purpose and correct use of RawByteString, or try to implement something
incompatible with Delphi :-(

Do you base your impression on paticular knowlege of how delphi RTL works or only on your ideas of how it should work?

Best regards,
Paul Ishenin.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to