* forgot to commit, part of r21765

git-svn-id: trunk@21766 -
This commit is contained in:
Jonas Maebe 2012-07-03 21:23:20 +00:00
parent 882351bb21
commit 3f5ae8b05f
2 changed files with 32 additions and 0 deletions

1
.gitattributes vendored
View File

@ -10196,6 +10196,7 @@ tests/test/jvm/trange3.pp svneol=native#text/plain
tests/test/jvm/tset1.pp svneol=native#text/plain
tests/test/jvm/tset3.pp svneol=native#text/plain
tests/test/jvm/tset7.pp svneol=native#text/plain
tests/test/jvm/tsetansistr.pp -text svneol=native#text/plain
tests/test/jvm/tstr.pp svneol=native#text/plain
tests/test/jvm/tstring1.pp svneol=native#text/plain
tests/test/jvm/tstring9.pp svneol=native#text/plain

View File

@ -0,0 +1,31 @@
program tsetansistr;
{$mode delphi}
{$modeswitch unicodestrings}
type
ByteArray = array of byte;
const
AnsiStrOffset = 1;
function AnsiStringOfBytes(const Src : ByteArray) : AnsiString;
var
i : integer;
begin
SetLength(Result, Length(Src));
for i := 0 to Length(Src) - 1 do
Result[i + AnsiStrOffset] := Chr(Src[i]);
end;
var
A : ByteArray;
B : AnsiString;
begin
DefaultSystemCodePage:=20127; // ASCII
SetLength(A, 1); A[0] := $98;
B := AnsiStringOfBytes(A);
if ord(B[1]) <> $98 then
halt(1);
end.