Re: [Lazarus] String vs WideString

2017-08-18 Thread Ondrej Pokorny via Lazarus
On 16.08.2017 22:40, Sven Barth via Lazarus wrote: Trunk supports Insert() and Delete() on dynamic arrays, Concat() and + are on the near term ToDo list. I eagerly wait for these (and for anonymous methods) :) Ondrej -- ___ Lazarus mailing list

Re: [Lazarus] String vs WideString

2017-08-18 Thread Sven Barth via Lazarus
Am 18.08.2017 10:42 schrieb "Michael Schnell via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 17.08.2017 11:27, Sven Barth via Lazarus wrote: >> >> >> Why do you want to stuff everything and the kitchen sink into TStrings? >> > To make use of the benefits the string type offers such as

Re: [Lazarus] String vs WideString

2017-08-18 Thread Graeme Geldenhuys via Lazarus
On 2017-08-18 12:02, Michael Schnell wrote: To explain my mail above in plain Text: Nice. :-) And clever email clients will even "format" the plain text emails - looking much better than your original HTML version. See attached screenshot of how your last email looked like here. Regards,

Re: [Lazarus] String vs WideString

2017-08-18 Thread Graeme Geldenhuys via Lazarus
On 2017-08-18 09:16, Tony Whyman via Lazarus wrote: Damn, should remember never to copy and paste from Wikipedia! Or simply use "plain text" emails to this mailing list. It reduces size considerably, and is still perfectly readable (like it has been for the last 30 years in email

Re: [Lazarus] String vs WideString

2017-08-18 Thread Michael Schnell via Lazarus
On 17.08.2017 11:27, Sven Barth via Lazarus wrote: Why do you want to stuff everything and the kitchen sink into TStrings? To make use of the benefits the string type offers such as reference counting and lazy copy. -Michael -- ___ Lazarus

Re: [Lazarus] String vs WideString

2017-08-18 Thread Tony Whyman via Lazarus
Damn, should remember never to copy and paste from Wikipedia! On 17/08/17 13:40, Michael Schnell via Lazarus wrote: On 17.08.2017 12:41, Tony Whyman via Lazarus wrote: Finally: "In UTF-16, code points greater or equal to 2^16 are encoded using /two/ 16-bit code units. 2¹⁵ ??? -Michael

Re: [Lazarus] String vs WideString

2017-08-17 Thread Luca Olivetti via Lazarus
El 17/08/17 a les 01:34, Graeme Geldenhuys via Lazarus ha escrit: On 2017-08-16 19:26, Luca Olivetti via Lazarus wrote: I mean, TBytes is just an "array of char". NO! Char can now mean a 1-byte char or a 2-byte char (I don't know how Sorry, I meant "array of byte". The point is it doesn't

Re: [Lazarus] String vs WideString

2017-08-17 Thread Ondrej Pokorny via Lazarus
On 17.08.2017 16:34, Graeme Geldenhuys via Lazarus wrote: On 2017-08-17 13:40, Marcos Douglas B. Santos via Lazarus wrote: Sorry, but every single warning is a... warning... that needs to be resolved. I feel exactly the same. :-) It took me ages to figure out how to change my code so I

Re: [Lazarus] String vs WideString

2017-08-17 Thread Graeme Geldenhuys via Lazarus
On 2017-08-17 13:40, Marcos Douglas B. Santos via Lazarus wrote: Sorry, but every single warning is a... warning... that needs to be resolved. I feel exactly the same. :-) It took me ages to figure out how to change my code so I could get rid of the "variable not initialized" whenever you

Re: [Lazarus] String vs WideString

2017-08-17 Thread Sven Barth via Lazarus
Am 17.08.2017 12:17 schrieb "Bart via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 8/17/17, Sven Barth via Lazarus wrote: > > >> really? delphi came from TP/BP... i was (still am, actually) using > > dynamic arrays in TP6 ;) > > > > Dynamic arrays in the form

Re: [Lazarus] String vs WideString

2017-08-17 Thread Sven Barth via Lazarus
Am 17.08.2017 14:32 schrieb "Michael Schnell via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 17.08.2017 12:09, Bart via Lazarus wrote: >> >> >> Variables of the ordinal type Char are used to store ASCII characters." >> >> > According to this wording, using Windows with ANSI character set

Re: [Lazarus] String vs WideString

2017-08-17 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 12:38 PM, Juha Manninen via Lazarus wrote: > On Wed, Aug 16, 2017 at 5:48 PM, Marcos Douglas B. Santos via Lazarus >> Are you saying that I need to do this? >> (following the firt example on this thread) > > No, if the parameter is

Re: [Lazarus] String vs WideString

2017-08-17 Thread Michael Schnell via Lazarus
On 17.08.2017 12:41, Tony Whyman via Lazarus wrote: Finally: "In UTF-16, code points greater or equal to 2^16 are encoded using /two/ 16-bit code units. 2¹⁵ ??? -Michael-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org

Re: [Lazarus] String vs WideString

2017-08-17 Thread Michael Schnell via Lazarus
On 17.08.2017 12:41, Tony Whyman via Lazarus wrote: UCS-2 differs from UTF-16 by being a constant length encoding and only capable of encoding characters of BMP, it is supported by many programs." Rather obviously Embarcadero primarily had UCS-2 in mind as they created the "Unicode aware"

Re: [Lazarus] String vs WideString

2017-08-17 Thread Michael Schnell via Lazarus
On 17.08.2017 12:09, Bart via Lazarus wrote: Variables of the ordinal type Char are used to store ASCII characters." According to this wording, using Windows with ANSI character set would be a no-go. -Michael -- ___ Lazarus mailing list

Re: [Lazarus] String vs WideString

2017-08-17 Thread Tony Whyman via Lazarus
On 16/08/17 11:05, Juha Manninen via Lazarus wrote: 2. Clean up the char type. ... Why shouldn't there be a single char type that intuitively represents a single character regardless of how many bytes are used to represent it. What do you mean by "a single character"? A "character" in Unicode

Re: [Lazarus] String vs WideString

2017-08-17 Thread Tony Whyman via Lazarus
On 16/08/17 11:05, Juha Manninen via Lazarus wrote: On Mon, Aug 14, 2017 at 4:21 PM, Tony Whyman via Lazarus wrote: UTF-16/Unicode can only store 65,536 characters while the Unicode standard (that covers UTF8 as well) defines 136,755 characters. UTF-16/Unicode's

Re: [Lazarus] String vs WideString

2017-08-17 Thread Bart via Lazarus
On 8/17/17, Sven Barth via Lazarus wrote: >> really? delphi came from TP/BP... i was (still am, actually) using > dynamic arrays in TP6 ;) > > Dynamic arrays in the form of "array of Type" were only introduced in > Delphi 3 if I remember correctly. Anything before

Re: [Lazarus] String vs WideString

2017-08-17 Thread Bart via Lazarus
On 8/17/17, Luca Olivetti via Lazarus wrote: > I started using strings as communication buffers since delphi 2. There > weren't even dynamic arrays then... From the Turbo Pascal Help: "A string type variable is a sequence of characters ..." And then when you

Re: [Lazarus] String vs WideString

2017-08-17 Thread Sven Barth via Lazarus
Am 17.08.2017 11:21 schrieb "Michael Schnell via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 16.08.2017 22:40, Sven Barth via Lazarus wrote: >> >> Trunk supports Insert() and Delete() on dynamic arrays, Concat() and + are on the near term ToDo list. > > > Supposedly "pos", as well. But that

Re: [Lazarus] String vs WideString

2017-08-17 Thread Michael Schnell via Lazarus
On 16.08.2017 22:40, Sven Barth via Lazarus wrote: Trunk supports Insert() and Delete() on dynamic arrays, Concat() and + are on the near term ToDo list. Supposedly "pos", as well. But that does not really help if we don't have a TStringList workalike, and supposedly several more library

Re: [Lazarus] String vs WideString

2017-08-17 Thread Michael Schnell via Lazarus
On 16.08.2017 20:26, Luca Olivetti via Lazarus wrote: Call me lazy but I don't want to reinvent the wheel and re-implement from scratch the functionality that a plain ansistring provides and TBytes to this day doesn't. So please continue in the thread "dynamic string proposal". Exactly this

Re: [Lazarus] String vs WideString

2017-08-16 Thread Sven Barth via Lazarus
Am 17.08.2017 04:16 schrieb "wkitty42--- via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 08/16/2017 06:46 PM, Luca Olivetti via Lazarus wrote: >> >> I started using strings as communication buffers since delphi 2. There >> weren't even dynamic arrays then... > > > really? delphi came from

Re: [Lazarus] String vs WideString

2017-08-16 Thread wkitty42--- via Lazarus
On 08/16/2017 06:46 PM, Luca Olivetti via Lazarus wrote: I started using strings as communication buffers since delphi 2. There weren't even dynamic arrays then... really? delphi came from TP/BP... i was (still am, actually) using dynamic arrays in TP6 ;) -- NOTE: No off-list assistance

Re: [Lazarus] String vs WideString

2017-08-16 Thread wkitty42--- via Lazarus
On 08/16/2017 07:30 PM, Graeme Geldenhuys via Lazarus wrote: On 2017-08-16 18:35, Sven Barth via Lazarus wrote: You are wrong. The string types in 3.0.x and 3.1 are like this: Thanks for correcting me. I was thinking of the "$modeswitch unicodestring" option. will that modeswitch take

Re: [Lazarus] String vs WideString

2017-08-16 Thread Graeme Geldenhuys via Lazarus
On 2017-08-16 23:46, Luca Olivetti via Lazarus wrote: I started using strings as communication buffers since delphi 2. There weren't even dynamic arrays then... Well, Link-Lists existed from the beginning of time. I used them plenty in my TP days, and adding, inserting, indexing etc was

Re: [Lazarus] String vs WideString

2017-08-16 Thread Graeme Geldenhuys via Lazarus
On 2017-08-16 19:26, Luca Olivetti via Lazarus wrote: I mean, TBytes is just an "array of char". NO! Char can now mean a 1-byte char or a 2-byte char (I don't know how FPC plans to support Unicode surrogate pairs which will require 4-bytes). In the olden days (Delphi 7 and FPC 2.6.4) the

Re: [Lazarus] String vs WideString

2017-08-16 Thread Graeme Geldenhuys via Lazarus
On 2017-08-16 18:35, Sven Barth via Lazarus wrote: You are wrong. The string types in 3.0.x and 3.1 are like this: Thanks for correcting me. I was thinking of the "$modeswitch unicodestring" option. Regards, Graeme -- ___ Lazarus mailing list

Re: [Lazarus] String vs WideString

2017-08-16 Thread Sven Barth via Lazarus
On 16.08.2017 20:26, Luca Olivetti via Lazarus wrote: > El 16/08/17 a les 01:17, Graeme Geldenhuys via Lazarus ha escrit: > >> In hind sight, using TBytes or TMemoryStream and it would have been >> very clear that it is a storage container for byte sized data, and no >> automatic conversion (by

Re: [Lazarus] String vs WideString

2017-08-16 Thread Luca Olivetti via Lazarus
El 16/08/17 a les 20:26, Luca Olivetti via Lazarus ha escrit: El 16/08/17 a les 01:17, Graeme Geldenhuys via Lazarus ha escrit: In hind sight, using TBytes or TMemoryStream and it would have been very clear that it is a storage container for byte sized data, and no automatic conversion (by

Re: [Lazarus] String vs WideString

2017-08-16 Thread Luca Olivetti via Lazarus
El 16/08/17 a les 01:17, Graeme Geldenhuys via Lazarus ha escrit: In hind sight, using TBytes or TMemoryStream and it would have been very clear that it is a storage container for byte sized data, and no automatic conversion (by the compiler) would be done to data stored in such containers.

Re: [Lazarus] String vs WideString

2017-08-16 Thread Sven Barth via Lazarus
On 16.08.2017 11:08, Graeme Geldenhuys via Lazarus wrote: > On 2017-08-16 09:43, Michael Schnell via Lazarus wrote: >> IMHO, any implementation of TStrings that forces a conversion (just >> because the class uses TStrings and not due to a logical demand), is a >> contradiction to providing code

Re: [Lazarus] String vs WideString

2017-08-16 Thread Sven Barth via Lazarus
On 15.08.2017 10:34, Tony Whyman via Lazarus wrote: > On 14/08/17 17:47, Sven Barth via Lazarus wrote: >> The main problem of such a dynamic type would be the inability to do >> fast indexing as the compiler would need to insert runtime checks for >> the size of a character. I had already thought

Re: [Lazarus] String vs WideString

2017-08-16 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 11:37 AM, Juha Manninen via Lazarus wrote: > On Wed, Aug 16, 2017 at 5:13 PM, Marcos Douglas B. Santos via Lazarus > wrote: >> Thanks. I know about this page... unfortunately looks like it is not >> enough,

Re: [Lazarus] String vs WideString

2017-08-16 Thread Juha Manninen via Lazarus
On Wed, Aug 16, 2017 at 5:13 PM, Marcos Douglas B. Santos via Lazarus wrote: > Thanks. I know about this page... unfortunately looks like it is not > enough, since many others still complain. What is missing? I can try to improve it. > This thread is not only

Re: [Lazarus] String vs WideString

2017-08-16 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 6:12 AM, Juha Manninen via Lazarus wrote: > On Mon, Aug 14, 2017 at 4:11 PM, Marcos Douglas B. Santos via Lazarus > wrote: >> Unicode everywhere and you using AnsiString and doing everything... >> Now I'm

Re: [Lazarus] String vs WideString

2017-08-16 Thread Graeme Geldenhuys via Lazarus
On 2017-08-16 11:05, Juha Manninen via Lazarus wrote: Unfortunately many other programmers had the same wrong idea or they were just lazy. The result anyway is a lot of broken UTF-16 code out there. Yeah, I see that even in commercial products and projects. It's very sad to see. Hence I

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 12:22, Juha Manninen via Lazarus wrote: You should stop writing in this thread now. I agree with Mattias. I perfectly agree with you. But you can't blame me for answering when asked. -Michael -- ___ Lazarus mailing list

Re: [Lazarus] String vs WideString

2017-08-16 Thread Juha Manninen via Lazarus
On Wed, Aug 16, 2017 at 12:12 PM, Michael Schnell via Lazarus wrote: > UTF-8 and UTF-16 are just encoding variants for 32 bit Unicode "characters", > storing them in n (or 2*n) Bytes according to a simple scheme. No, they are encodings for codepoints, not

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 11:55, Mattias Gaertner via Lazarus wrote: 1,114,112 possible code points need at most 21 bits. Due to encoding at most 32bit. Sorry. Typo. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org

Re: [Lazarus] String vs WideString

2017-08-16 Thread Juha Manninen via Lazarus
On Mon, Aug 14, 2017 at 4:21 PM, Tony Whyman via Lazarus wrote: > UTF-16/Unicode can only store 65,536 characters while the Unicode standard > (that covers UTF8 as well) defines 136,755 characters. > UTF-16/Unicode's main advantage seems to be for rapid indexing of

Re: [Lazarus] String vs WideString

2017-08-16 Thread Mattias Gaertner via Lazarus
On Wed, 16 Aug 2017 11:33:04 +0200 Michael Schnell via Lazarus wrote: >[...] > But in fact "Unicode" is just a universal standard defining 64 bit > entities. No. 1,114,112 possible code points need at most 21 bits. Due to encoding at most 32bit. Mattias --

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 11:32, Mattias Gaertner via Lazarus wrote: Anyone who wants to discuss the grand picture of strings in FPC for the millionth time should start a new topic. Right you are. And it will be by far too late and futile, anyway, because of the reasons discussed a million times.

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 11:08, Graeme Geldenhuys via Lazarus wrote: Are you suggesting that internally TStrings should have different storage for all possible languages, Not at all. In the said paper I point out that a new fully dynamical string encoding brand would be introduced and same is used for

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 11:08, Graeme Geldenhuys via Lazarus wrote: So it makes sense that TStrings should use UnicodeString internally to store its data. The Unicode standard is also the only standard that can support any language. But in fact "Unicode" is just a universal standard defining 64 bit

Re: [Lazarus] String vs WideString

2017-08-16 Thread Mattias Gaertner via Lazarus
On Wed, 16 Aug 2017 11:09:17 +0200 Michael Schnell via Lazarus wrote: > On 16.08.2017 10:58, Mattias Gaertner via Lazarus wrote: > > This thread is going out of topic. > > Please start a new thread if you want to discuss Delphi strings. > You can't discuss fpc's

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 16.08.2017 10:58, Mattias Gaertner via Lazarus wrote: This thread is going out of topic. Please start a new thread if you want to discuss Delphi strings. You can't discuss fpc's string problems without mentioning Delphi, as they are a direct consequence as well of Delphi-compatibility as of

Re: [Lazarus] String vs WideString

2017-08-16 Thread Graeme Geldenhuys via Lazarus
On 2017-08-16 09:43, Michael Schnell via Lazarus wrote: IMHO, any implementation of TStrings that forces a conversion (just because the class uses TStrings and not due to a logical demand), is a contradiction to providing code aware strings at all. But in FPC 3.x (using modern compiler modes -

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Van Canneyt via Lazarus
On Wed, 16 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 22:45, Graeme Geldenhuys via Lazarus wrote: How is that not "abuse"??? IMHO it's a major shortcoming to define "string" as "printable text". On the contrary. That is exactly what it means. Anything else is just a

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 15.08.2017 22:45, Graeme Geldenhuys via Lazarus wrote: How is that not "abuse"??? IMHO it's a major shortcoming to define "string" as "printable text". In fact the name "String" does not suggest this at all. A "string" in my understanding just is a sequence of similar "things". A

Re: [Lazarus] String vs WideString

2017-08-16 Thread Juha Manninen via Lazarus
On Wed, Aug 16, 2017 at 8:53 AM, Bo Berglund via Lazarus wrote: > Based on this experience I wanted to alert the OP of the fact that > using AnsiString instead of string is not a cure-all for binary data, > you need to fix the codepage too, which is what the

Re: [Lazarus] String vs WideString

2017-08-16 Thread Mattias Gaertner via Lazarus
On Wed, 16 Aug 2017 10:47:37 +0200 Michael Schnell via Lazarus wrote: > On 15.08.2017 19:29, Luca Olivetti via Lazarus wrote: > > I has worked extremely well and reliably until fpc 2.6.4 (i.e. with > > string=ansistring). > > Does it not work in 3.x? > I

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 15.08.2017 21:38, Ondrej Pokorny via Lazarus wrote: Furthermore, if you use(d) strings for binary data, just replace old string for AnsiString/RawByteString (and Char for AnsiChar, PChar for PAnsiChar) and you are good to go. Annoying but no big deal. This only works if all tools that you

Re: [Lazarus] String vs WideString

2017-08-16 Thread Michael Schnell via Lazarus
On 15.08.2017 19:18, Graeme Geldenhuys via Lazarus wrote: Why can't that be changed to a UnicodeString or UTF8String IMHO, any implementation of TStrings that forces a conversion (just because the class uses TStrings and not due to a logical demand), is a contradiction to providing code

Re: [Lazarus] String vs WideString

2017-08-15 Thread Bo Berglund via Lazarus
On Tue, 15 Aug 2017 21:22:10 +0200, Luca Olivetti via Lazarus wrote: >(I remarked the "if" because I don't know if that's the case, according >to Bo Berglund's experience it is) Just to expand on my "experience" and the reason I posted: My work on converting the

Re: [Lazarus] String vs WideString

2017-08-15 Thread Graeme Geldenhuys via Lazarus
On 2017-08-15 20:22, Luca Olivetti via Lazarus wrote: Wait a minute, why "abuse"? After all, before code aware strings, an ansistring could store any kind of arbitrary data with no problem and no conversion, and made it extremely easy Just listen to what you are saying A string type and

Re: [Lazarus] String vs WideString

2017-08-15 Thread Luca Olivetti via Lazarus
El 15/08/17 a les 22:08, Luca Olivetti ha escrit: El 15/08/17 a les 21:38, Ondrej Pokorny via Lazarus ha escrit: On 15.08.2017 21:34, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 21:22:10 +0200 Luca Olivetti via Lazarus wrote: [...] *If* code that

Re: [Lazarus] String vs WideString

2017-08-15 Thread Luca Olivetti via Lazarus
El 15/08/17 a les 21:38, Ondrej Pokorny via Lazarus ha escrit: On 15.08.2017 21:34, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 21:22:10 +0200 Luca Olivetti via Lazarus wrote: [...] *If* code that worked before (and dare I say without abusing the

Re: [Lazarus] String vs WideString

2017-08-15 Thread Luca Olivetti via Lazarus
El 15/08/17 a les 21:38, Ondrej Pokorny via Lazarus ha escrit: On 15.08.2017 21:34, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 21:22:10 +0200 Luca Olivetti via Lazarus wrote: [...] *If* code that worked before (and dare I say without abusing the

Re: [Lazarus] String vs WideString

2017-08-15 Thread Ondrej Pokorny via Lazarus
On 15.08.2017 21:34, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 21:22:10 +0200 Luca Olivetti via Lazarus wrote: [...] *If* code that worked before (and dare I say without abusing the language) suddenly breaks, the bug is in the compiler and not in

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Tue, 15 Aug 2017 21:22:10 +0200 Luca Olivetti via Lazarus wrote: >[...] > *If* code that worked before (and dare I say without abusing the > language) suddenly breaks, the bug is in the compiler and not in the > library. ... unless of course the

Re: [Lazarus] String vs WideString

2017-08-15 Thread Luca Olivetti via Lazarus
El 15/08/17 a les 21:14, Graeme Geldenhuys via Lazarus ha escrit: On 2017-08-15 18:29, Luca Olivetti via Lazarus wrote: but for 3rd party libraries/components (e.g. synapse comes to mind Then better start filing bug reports to all those 3rd party libraries and components - they have been

Re: [Lazarus] String vs WideString

2017-08-15 Thread Graeme Geldenhuys via Lazarus
On 2017-08-15 18:29, Luca Olivetti via Lazarus wrote: but for 3rd party libraries/components (e.g. synapse comes to mind Then better start filing bug reports to all those 3rd party libraries and components - they have been abusing the system and will silently fail. Not to mention that FPC is

Re: [Lazarus] String vs WideString

2017-08-15 Thread wkitty42--- via Lazarus
On 08/15/2017 05:25 AM, Michael Van Canneyt via Lazarus wrote: As it is now, FPC offers a way out for all cases: WideString/UnicodeString for those that want 2-byte characters. what if 3 and 4 byte characters are required? will they also work in UnicodeStrings? i'm looking at this from a

Re: [Lazarus] String vs WideString

2017-08-15 Thread Graeme Geldenhuys via Lazarus
On 2017-08-15 10:52, Michael Van Canneyt via Lazarus wrote: The only 'problem' is that TStrings uses a single-byte string. Why can't that be changed to a UnicodeString or UTF8String - after all, the Unicode standard is meant to support all languages. I would have thought that would be an

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Tue, 15 Aug 2017 16:44:30 +0200 Michael Schnell via Lazarus wrote: > On 15.08.2017 14:53, Mattias Gaertner via Lazarus wrote: > > Do you mean a 'char' is a string in your proposal? > Nope. In my proposal there would be Chars for any statically encoded >

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 14:53, Mattias Gaertner via Lazarus wrote: Do you mean a 'char' is a string in your proposal? Nope. In my proposal there would be Chars for any statically encoded String Type, hence 1, 2, 4, and 8 byte wide. (As regarding statically encoded string (and char) brands, it's just an

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Van Canneyt via Lazarus
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 14:26:34 +0200 Michael Schnell via Lazarus wrote: On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: > Why shouldn't there be a single char type that intuitively represents > a

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Tue, 15 Aug 2017 14:26:34 +0200 Michael Schnell via Lazarus wrote: > On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: > > Why shouldn't there be a single char type that intuitively represents > > a single character regardless of how many bytes are used to

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: 3. The problem with string handling today is that it is not based on a consistent approach to the character type. If you clean up character handling then the model for string handling should become obvious. A string is after all no

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: Why shouldn't there be a single char type that intuitively represents a single character regardless of how many bytes are used to represent it. I suppose by "char" you mean "single printable thingy" with Unicode it's rather debatable what

Re: [Lazarus] String vs WideString

2017-08-15 Thread Bart via Lazarus
On 8/15/17, Tony Whyman via Lazarus wrote: > 2. Clean up the char type. > > Why shouldn't there be a single char > type that intuitively represents a single character regardless of > how many bytes are used to represent it. You would have to define

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Van Canneyt via Lazarus
On Tue, 15 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 12:15, Michael Van Canneyt via Lazarus wrote: What does S[2] mean in your proposal ? Is it 1, 2, 4 or even 8 bytes ? Regarding the users' appreciation, the S[x] notation is decently incompatible between the different

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 12:15, Michael Van Canneyt via Lazarus wrote: What does S[2] mean in your proposal ? Is it 1, 2, 4 or even 8 bytes ? Regarding the users' appreciation, the S[x] notation is decently incompatible between the different string types and compiler versions. There were hundreds of

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 12:11, Mattias Gaertner via Lazarus wrote: It does not explain what the characters of DynamicString are, does it? I don't understand what you are asking. The element size and encoding of a Dynamic String ("CP_ANY" in the document) are not predefined, but depend on the content:

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Van Canneyt via Lazarus
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 12:02:28 +0200 Michael Schnell via Lazarus wrote: On 15.08.2017 11:52, Michael Van Canneyt via Lazarus wrote: > This cannot be solved properly except by duplicating the classes unit.

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Tue, 15 Aug 2017 12:02:28 +0200 Michael Schnell via Lazarus wrote: > On 15.08.2017 11:52, Michael Van Canneyt via Lazarus wrote: > > This cannot be solved properly except by duplicating the classes unit. > > Sorry to disagree, but IMHO this can only be solved

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 11:52, Michael Van Canneyt via Lazarus wrote: This cannot be solved properly except by duplicating the classes unit. Sorry to disagree, but IMHO this can only be solved properly by defining an additional fully dynamically encoded string type and use same for TStrings (see ->

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: In this case, I would argue that both are true. And the culprit obviously is Embarcadeo and not the fpc or the Lazarus team, who did their best to try to do a compatible and implementation that is really workable on the multiple supported

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Van Canneyt via Lazarus
On Tue, 15 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 11:25, Michael Van Canneyt via Lazarus wrote: WideString/UnicodeString for those that want 2-byte characters. A codepage-aware single-byte string for those that want 1-byte characters. The shortstring is even still

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 15.08.2017 11:25, Michael Van Canneyt via Lazarus wrote: WideString/UnicodeString for those that want 2-byte characters. A codepage-aware single-byte string for those that want 1-byte characters. The shortstring is even still available. IM (often stated) O, this does not help as long as

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Van Canneyt via Lazarus
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Mon, 14 Aug 2017 18:47:58 +0200 Sven Barth via Lazarus wrote: [...] The main problem of such a dynamic type would be the inability to do fast indexing as the compiler would need to insert runtime

Re: [Lazarus] String vs WideString

2017-08-15 Thread Tony Whyman via Lazarus
You can me as a "like" on that one. On 15/08/17 10:13, Mattias Gaertner via Lazarus wrote: IMHO the main problem of adding a new string type is https://xkcd.com/927/ -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org

Re: [Lazarus] String vs WideString

2017-08-15 Thread Tony Whyman via Lazarus
On 14/08/17 22:01, Juha Manninen via Lazarus wrote: Tony Whyman, this issue has been discussed again and again for the past 10+ years first in FPC mailing lists and then in Lazarus lists. The current Unicode support in Lazarus works f***ing well and is amazingly compatible with Delphi. WinAPI

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Mon, 14 Aug 2017 18:47:58 +0200 Sven Barth via Lazarus wrote: >[...] > The main problem of such a dynamic type would be the inability to do fast > indexing as the compiler would need to insert runtime checks for the size > of a character. I had already thought

Re: [Lazarus] String vs WideString

2017-08-15 Thread Mattias Gaertner via Lazarus
On Sat, 12 Aug 2017 17:56:58 -0300 "Marcos Douglas B. Santos via Lazarus" wrote: >[...] > > Which one? Do you mean Windows CP-1252? > > Yes... > But would it make any difference? Just > >>[...] > >> Warning: Implicit string type conversion from "AnsiString" to

Re: [Lazarus] String vs WideString

2017-08-15 Thread Tony Whyman via Lazarus
On 14/08/17 17:47, Sven Barth via Lazarus wrote: The main problem of such a dynamic type would be the inability to do fast indexing as the compiler would need to insert runtime checks for the size of a character. I had already thought the same, but then had to discard the idea due to this.

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 14.08.2017 18:47, Sven Barth via Lazarus wrote: The main problem of such a dynamic type would be the inability to do fast indexing as the compiler would need to insert runtime checks for the size of a character. What "indexing" do you think of ? Could you give an example where such a

Re: [Lazarus] String vs WideString

2017-08-15 Thread Michael Schnell via Lazarus
On 14.08.2017 18:49, Sven Barth via Lazarus wrote: Because the crowd demanding Delphi compatibility is larger than the crowd demanding exact terminology. ... or even a revised concept avoiding the junk presented by Embarcadero :( But obviously the fpc team has no choice. -Michael --

Re: [Lazarus] String vs WideString

2017-08-14 Thread Sven Barth via Lazarus
Am 14.08.2017 16:11 schrieb "Tony Whyman via Lazarus" < lazarus@lists.lazarus-ide.org>: > If nothing else, FPC Lazarus could do with a clean-up of both terminology and string types. Indeed, why isn't there a single container string type for all character sets where the encoding whether a legacy

Re: [Lazarus] String vs WideString

2017-08-14 Thread Tony Whyman via Lazarus
On 14/08/17 14:46, Mattias Gaertner via Lazarus wrote: You made need UTF-16/Unicode support for accessing Microsoft APIs but apart from that, why is it being promoted as the universal standard? Who does that? Mattias Because the obvious implication when someone argues against AnsiString

Re: [Lazarus] String vs WideString

2017-08-14 Thread Graeme Geldenhuys via Lazarus
On 2017-08-13 11:51, Juha Manninen via Lazarus wrote: Now is year 2017, Unicode has been used for decades. Everybody should use it by now. Indeed, I can't agree more. Plus, I normally use UTF-8 for any text files I create. Regards, Graeme --

Re: [Lazarus] String vs WideString

2017-08-14 Thread Michael Schnell via Lazarus
On 14.08.2017 14:50, Marcos Douglas B. Santos via Lazarus wrote: "The right solution is to use Unicode everywhere." Embarcadero though that this would not b the "right" solution. Otherwise they would not have invented the encoding aware strings. IMHO that was a good idea. They only

Re: [Lazarus] String vs WideString

2017-08-14 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Aug 14, 2017 at 6:53 AM, Tony Whyman via Lazarus wrote: > > On 13/08/17 12:18, Juha Manninen via Lazarus wrote: >> >> Unicode was designed to solve exactly the problems caused by locale >> differences. >> Why don't you use it? > > I believe you effectively

Re: [Lazarus] String vs WideString

2017-08-14 Thread Tony Whyman via Lazarus
On 13/08/17 12:18, Juha Manninen via Lazarus wrote: Unicode was designed to solve exactly the problems caused by locale differences. Why don't you use it? I believe you effectively answer your own question in your preceding post: Actually using the Windows system codepage is not safe any

Re: [Lazarus] String vs WideString

2017-08-14 Thread Michael Schnell via Lazarus
On 13.08.2017 22:41, Juha Manninen via Lazarus wrote: You have misused "String" or "AnsiString" from the beginning for binary data. There have always been warnings against it. While this might be true, it's decently silly, IMHO. The name "String" can easily be interpreted as "String of things"

Re: [Lazarus] String vs WideString

2017-08-13 Thread Bo Berglund via Lazarus
On Sun, 13 Aug 2017 14:18:23 +0300, Juha Manninen via Lazarus wrote: >On Sun, Aug 13, 2017 at 1:21 AM, Bo Berglund via Lazarus > wrote: >> I recently had a problem with an application that was converted from >> old string type to

Re: [Lazarus] String vs WideString

2017-08-13 Thread Juha Manninen via Lazarus
On Sun, Aug 13, 2017 at 1:21 AM, Bo Berglund via Lazarus wrote: > I recently had a problem with an application that was converted from > old string type to AnsiString and seemingly worked in the new Unicode > environment. What was the old string type? > However,

Re: [Lazarus] String vs WideString

2017-08-13 Thread Juha Manninen via Lazarus
On Sun, Aug 13, 2017 at 1:21 AM, Bo Berglund via Lazarus wrote: > So AnsiString is not safe either That is a little misleading. Actually using the Windows system codepage is not safe any more. The current Unicode system in Lazarus maps AnsiString to use UTF-8.

Re: [Lazarus] String vs WideString

2017-08-12 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Aug 12, 2017 at 5:32 PM, Mattias Gaertner via Lazarus wrote: > On Sat, 12 Aug 2017 16:46:09 -0300 > "Marcos Douglas B. Santos via Lazarus" > wrote: > >>[...] >> Lib.SetLicense( >> IniFile.ReadString('TheLib',

  1   2   >