There is nothing arbitrary about this. The code page aware
AnsiString type was
the big feature (and change) in FPC 3.0.0 (see
here which also references
this). The FPC RTL itself initializes with the code page of the operating system, but Lazarus forces this to be UTF-8 (see
here), thus why you don't have any problem with a command line application, but see this issue with a LCL GUI application.
To better explain where your problem is:
s:='('+#176+')';
Result:=Copy(s, 2, 1)=#176;
The string constant at the right side of the assignment to
s is in your system's code page. Due to the LCL's setting of using UTF-8 by default the assignment will convert the string to UTF-8 (you can see this by using
Length(s), it will return a value > 3). Thus the following
Copy will extract only a part of the UTF-8 character for
#176, thus the comparison will fail.