mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-19 09:51:32 +02:00
50 lines
834 B
ObjectPascal
50 lines
834 B
ObjectPascal
{$mode objfpc} {$H+}
|
|
uses
|
|
{$ifdef unix}
|
|
cwstring,
|
|
{$endif unix}
|
|
sysutils;
|
|
|
|
type
|
|
ts866 = type AnsiString(866);
|
|
ts1252 = type AnsiString(1252);
|
|
|
|
procedure doerror(ANumber : Integer);
|
|
begin
|
|
WriteLn('error ',ANumber);
|
|
Halt(ANumber);
|
|
end;
|
|
|
|
var
|
|
s : ts866;
|
|
x : ts1252;
|
|
ss : shortstring;
|
|
i : Integer;
|
|
begin
|
|
ss := #128#156#196;
|
|
|
|
s := ss;
|
|
if (StringCodePage(s) <> 866) then
|
|
doerror(1);
|
|
if (Length(s) <> Length(ss)) then
|
|
doerror(2);
|
|
for i := 1 to Length(s) do
|
|
begin
|
|
if (Byte(s[i]) <> Byte(ss[i])) then
|
|
doerror(3)
|
|
end;
|
|
|
|
x := ss;
|
|
if (StringCodePage(x) <> 1252) then
|
|
doerror(4);
|
|
if (Length(x) <> Length(ss)) then
|
|
doerror(5);
|
|
for i := 1 to Length(x) do
|
|
begin
|
|
if (Byte(x[i]) <> Byte(ss[i])) then
|
|
doerror(6)
|
|
end;
|
|
|
|
WriteLn('Ok');
|
|
end.
|