On 07/28/2016 11:38 AM, Santiago A. wrote:
And what are the rules for changing left side operand?
Extremely hard to define when trying to follow any decent logic, unless
the decision is either "never" (i.e. a strictly static typing) or
"always" (a strictly dynamic typing).
A way out could be
El 27/07/2016 a las 16:10, Michael Schnell escribió:
> On 07/26/2016 04:19 PM, Michael Van Canneyt wrote:
>>
>> This is not correct. In pascal the right-hand side of an assignment
>> has a well-defined type. The compiler checks whether the type on the
>> right is assignment-compatible to the left
On 07/26/2016 04:19 PM, Michael Van Canneyt wrote:
This is not correct. In pascal the right-hand side of an assignment
has a well-defined type. The compiler checks whether the type on the
right is assignment-compatible to the left side.
Hmm.
if you do
x := y + z;
with x a real and y and
On Tue, 26 Jul 2016, Santiago A. wrote:
El 26/07/2016 a las 16:19, Michael Van Canneyt escribió:
On Tue, 26 Jul 2016, Santiago A. wrote:
El 26/07/2016 a las 12:27, Mattias Gaertner escribió:
a3:=a1+a2 => cp = 1252
a3:=a2+a1 => cp = 65001
Is that the expected behavior?
IMHO the result
El 26/07/2016 a las 16:19, Michael Van Canneyt escribió:
>
>
> On Tue, 26 Jul 2016, Santiago A. wrote:
>
>> El 26/07/2016 a las 12:27, Mattias Gaertner escribió:
>>> a3:=a1+a2 => cp = 1252
>>> a3:=a2+a1 => cp = 65001
>> Is that the expected behavior?
>>
>> IMHO the result should be the same. And
Santiago A. wrote on Tue, 26 Jul 2016:
El 26/07/2016 a las 12:27, Mattias Gaertner escribió:
a3:=a1+a2 => cp = 1252
a3:=a2+a1 => cp = 65001
Is that the expected behavior?
IMHO the result should be the same. And the only way is to make it
depend on a3, no matter what is in the left side.
On Tue, 26 Jul 2016, Santiago A. wrote:
El 26/07/2016 a las 12:27, Mattias Gaertner escribió:
a3:=a1+a2 => cp = 1252
a3:=a2+a1 => cp = 65001
Is that the expected behavior?
IMHO the result should be the same. And the only way is to make it
depend on a3, no matter what is in the left side.
El 26/07/2016 a las 12:27, Mattias Gaertner escribió:
> a3:=a1+a2 => cp = 1252
> a3:=a2+a1 => cp = 65001
Is that the expected behavior?
IMHO the result should be the same. And the only way is to make it
depend on a3, no matter what is in the left side. That's the way things
are done in Pascal
On Tue, 26 Jul 2016 12:03:21 +0200
Jonas Maebe wrote:
> Mattias Gaertner wrote on Tue, 26 Jul 2016:
>
> > It seems the Delphi rules for non rawbytestrings are:
> > - Concatenate two same declared strings: append bytes, copy dyn. cp
> > from left operand. Declared cp
Mattias Gaertner wrote on Tue, 26 Jul 2016:
It seems the Delphi rules for non rawbytestrings are:
- Concatenate two same declared strings: append bytes, copy dyn. cp
from left operand. Declared cp of result is left operand.
Are you sure it's "append bytes" here and not "append bytes if
On Tue, 26 Jul 2016 11:01:28 +0200
Jonas Maebe wrote:
>[...]
> Could you try the same program with u1 as plain ansistring instead of
> utf8string? (with an additional
> "setcodepage(rawbytestring(u1),65001,false);" after assigning u1)
Sure:
{$APPTYPE CONSOLE}
Mattias Gaertner wrote on Tue, 26 Jul 2016:
On Mon, 25 Jul 2016 23:23:23 +0200
Jonas Maebe wrote:
Thanks. So the rule for concatenation appears to be:
* the dynamic code page of the result of a string concatenation is that
of the left operand (except if it's an
On Mon, 25 Jul 2016 23:23:23 +0200
Jonas Maebe wrote:
> On 25/07/16 23:07, Mattias Gaertner wrote:
> > DefaultSystemCodePage = 1252
> > s3 = "abcdef" cp = 65001
>
> Thanks. So the rule for concatenation appears to be:
> * the dynamic code page of the result of a
On 25/07/16 23:07, Mattias Gaertner wrote:
DefaultSystemCodePage = 1252
s3 = "abcdef" cp = 65001
Thanks. So the rule for concatenation appears to be:
* the dynamic code page of the result of a string concatenation is that
of the left operand (except if it's an empty string, then it's that of
On Mon, 25 Jul 2016 22:25:59 +0200
Jonas Maebe wrote:
> On 23/07/16 13:31, Petr Kohut wrote:
> > Hello,
> > here are results:
>
> Thanks a lot. Could you test one more? I think I will have all
> information I need then.
>
>
> Jonas
>
> {$APPTYPE CONSOLE}
>
>
On 23/07/16 13:31, Petr Kohut wrote:
Hello,
here are results:
Thanks a lot. Could you test one more? I think I will have all
information I need then.
Jonas
{$APPTYPE CONSOLE}
type
tcp866 = type ansistring(866);
var
s1, s2, s3: tcp866;
begin
s1:='abc';
cp = 65001
r3="AAä" cp=65001
r3="AA?" cp=65001
s3="AAä" cp=65001
s3="AA?" cp=65001
*)
-- Původní zpráva --
Od: "Jonas Maebe" <jonas.ma...@elis.ugent.be>
Komu: "FPC-Pascal users discussions" <fpc-pascal@lists.
On 23/07/16 12:58, wkitt...@windstream.net wrote:
On 07/23/2016 06:13 AM, Jonas Maebe wrote:
[...]
var
s1,s2,s3: AnsiString;
r1,r2,r3: RawByteString;
begin
s1:='A'; // 1252
s2:='Aä'; // 1252
writeln('s1="',s1,'" cp=',StringCodePage(s1));
writeln('s2="',s1,'"
On 07/23/2016 06:13 AM, Jonas Maebe wrote:
[...]
var
s1,s2,s3: AnsiString;
r1,r2,r3: RawByteString;
begin
s1:='A'; // 1252
s2:='Aä'; // 1252
writeln('s1="',s1,'" cp=',StringCodePage(s1));
writeln('s2="',s1,'" cp=',StringCodePage(s2));
writeln('s2="',s2,'"
On 23/07/16 12:13, Jonas Maebe wrote:
On 23/07/16 08:11, Mattias Gaertner wrote:
Here is a result of Delphi 10.1:
Thank you (also Petr). Maybe one more, to know what happens if you mix
rawbytestring and ansistring in the concatenation:
program DTestConcatenate;
{$APPTYPE CONSOLE}
{$R
On 23/07/16 08:11, Mattias Gaertner wrote:
Here is a result of Delphi 10.1:
Thank you (also Petr). Maybe one more, to know what happens if you mix
rawbytestring and ansistring in the concatenation:
program DTestConcatenate;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
var
1
ResultA := AnsiStrA + AnsiToUtf8(AnsiStrA);
ResultA: 1250
*)
-- Původní zpráva --
Od: "Bart" <bartjun...@gmail.com>
Komu: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org>
Odesláno: 23.07.2016 0:29:32
Předmět: Re: [fpc-pascal] Weird
On Sat, 23 Jul 2016 00:29:32 +0200
Bart wrote:
> On 7/22/16, Jonas Maebe wrote:
>
> >> ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB :=
> >> AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252
> >>
> >>
> >> And resultA
On 7/22/16, Jonas Maebe wrote:
>> ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB :=
>> AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252
>>
>>
>> And resultA is not equal to ResultB
>>
>> It doesn't look like too intuitive.
>
> It would be
On 22/07/16 21:49, Santiago A. wrote:
El 22/07/2016 a las 17:56, Jonas Maebe escribió:
There is no hidden secret knowledge. Everything is documented and the
information is linked from the release notes. The "principle of least
surprise" has been applied in the sense that we didn't invent our
On 2016-07-22 20:49, Santiago A. wrote:
> In addition, changing the codepage on the fly if a bad idea.
+1
I think that is very much the wrong behaviour too. As I mentioned before
is this mailing list. I think the FPC 3.x with these codepage aware
AnsiStrings is a damn mess. As far as I can see,
El 22/07/2016 a las 17:56, Jonas Maebe escribió:
>
> There is no hidden secret knowledge. Everything is documented and the
> information is linked from the release notes. The "principle of least
> surprise" has been applied in the sense that we didn't invent our own
> system that introduces small
On 22/07/16 17:33, Santiago A. wrote:
So
ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB :=
AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252
And resultA is not equal to ResultB
It doesn't look like too intuitive.
It would be good if someone with access to Delphi
El 22/07/2016 a las 15:03, Jonas Maebe escribió:
>
> See again
> http://wiki.freepascal.org/FPC_Unicode_support#String_concatenations
> (same as before).
So
ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB :=
AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252
And
On 22/07/16 14:14, Santiago A. wrote:
program testconvertstr;
You are missing {$h+} here. When posting programs, always include all
switches and/or all command line options. The program also compiles with
string = shortstring (the default), but has different behaviour in that
case.
var
On 2016-07-22 13:14, Santiago A. wrote:
> I'm definitively completely lost
:) So am I.
Regards,
Graeme
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
El 22/07/2016 a las 12:55, Bart escribió:
> Just check the vaue of StringCodePage(Utf8StrA).
Not Initialized
AnsiStrA: 1252
ResultA: 1252
AnsiStrA:=' '
AnsiStrA: 0
AnsiStrA[1]:=#243; // o acute win-1252
AnsiStrA: 0
ResultA:=AnsiStrA
ResultA: 0
ResultA := AnsiStrA + ' '
ResultA:
On 2016-07-22 11:55, Bart wrote:
> Gives:
> StringCodePage(AnsiStrA) now is: 65001
> AnsiStrA: 195 179
I don't understand, why did AnsiStrA change its codepage type after the
3rd assignment to it?
Here is the results on my Windows 7 system.
==
$
On 7/22/16, Santiago A. wrote:
> // is Utf8StrA now utf8string? or something similar like Ansistring(UTF_8)
> // is Utf8StrB now utf8string? or something similar like Ansistring(UTF_8)
Just check the vaue of StringCodePage(Utf8StrA).
procedure
El 22/07/2016 a las 0:32, Bart escribió:
> On 7/21/16, Santiago A. wrote:
>
>> I've come across this issue: When I concatenate two strings in UTF8 they
>> are converted to ansi (Win-1252) .
> You have declared all string variables as plain "string", which is the
> same as
On 7/21/16, Santiago A. wrote:
> I've come across this issue: When I concatenate two strings in UTF8 they
> are converted to ansi (Win-1252) .
You have declared all string variables as plain "string", which is the
same as AnsiString(CP_ACP). So all string variables have the
Hello:
I'm working on windows XP, FPC 3.0.0 from stable Lazarus 1.6.
I've come across this issue: When I concatenate two strings in UTF8 they
are converted to ansi (Win-1252) .
A bug?
Am I missing something?
I have attached a demo.
--
Saludos
Santiago A.
program testconvertstr;
37 matches
Mail list logo