blob: 01fbaf51aae1c692bca992c031cfdcd59d1be4d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
{$APPTYPE CONSOLE}
{$ifdef go32v2}
{$define USE_INTERNAL_UNICODE}
{$endif}
{$ifdef USE_INTERNAL_UNICODE}
{$define USE_FPWIDESTRING_UNIT}
{$define USE_UNICODEDUCET_UNIT}
{$define USE_CPALL_UNIT}
{$endif}
uses
{$ifdef unix}
{$ifdef darwin}iosxwstr{$else}cwstring{$endif},
{$endif unix}
{$ifdef USE_UNICODEDUCET_UNIT}
unicodeducet,
{$endif}
{$ifdef USE_FPWIDESTRING_UNIT}
fpwidestring,
{$endif}
{$ifdef USE_CPALL_UNIT}
cpall,
{$endif}
sysutils;
const
{$ifdef android}
cp1 = 1251;
cp2 = 1252;
cp3 = 65001;
{$else}
cp1 = 866;
cp2 = 850;
cp3 = 1251;
{$endif}
type
ts1 = type AnsiString(cp1);
ts2 = type AnsiString(cp2);
ts3 = type AnsiString(cp3);
var
a : ts3;
b : ts2;
c, d : ts1;
begin
a := 'al';
b := 'b2';
d := 'd4';
//without "DestS" in the array
c := '';
c := a + b;
if (StringCodePage(c) <> cp1) then
halt(1);
c := '';
c := a + d;
if (StringCodePage(c) <> cp1) then
halt(2);
c := '';
c := d + b;
if (StringCodePage(c) <> cp1) then
halt(3);
//with empty "DestS" in the array
c := '';
c := c + a ;
if (StringCodePage(c) <> cp1) then
halt(4);
c := '';
c := c + d ;
if (StringCodePage(c) <> cp1) then
halt(5);
//with "DestS" in the array at the start
c := c + a ;
if (StringCodePage(c) <> cp1) then
halt(6);
//with "DestS" in the array, not at the start
c := a + c;
if (StringCodePage(c) <> cp1) then
halt(7);
WriteLn('ok');
end.
|