mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 20:49:49 +02:00
* forgot to commit, part of r21765
git-svn-id: trunk@21766 -
This commit is contained in:
parent
882351bb21
commit
3f5ae8b05f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
31
tests/test/jvm/tsetansistr.pp
Normal file
31
tests/test/jvm/tsetansistr.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user