Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Sven Barth via Lazarus
On 07.05.2017 12:17, Florian Klaempfl via Lazarus wrote: > Am 07.05.2017 um 12:11 schrieb Sven Barth via Lazarus: >> Am 07.05.2017 12:07 schrieb "Florian Klaempfl via Lazarus" >> mailto:lazarus@lists.lazarus-ide.org>>: >>> >>> Am 07.05.2017 um 11:57 schrieb Graeme Geldenhuys via Lazarus: On 20

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Graeme Geldenhuys via Lazarus
On 2017-05-07 11:17, Florian Klaempfl via Lazarus wrote: > Then something is wrong/broken :) I rest my case. :-P Regards, Graeme -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Florian Klaempfl via Lazarus
Am 07.05.2017 um 12:11 schrieb Sven Barth via Lazarus: > Am 07.05.2017 12:07 schrieb "Florian Klaempfl via Lazarus" > mailto:lazarus@lists.lazarus-ide.org>>: >> >> Am 07.05.2017 um 11:57 schrieb Graeme Geldenhuys via Lazarus: >> > On 2017-05-07 09:10, Florian Klaempfl via Lazarus wrote: >> >>> Yeah

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Florian Klaempfl via Lazarus
Am 07.05.2017 um 11:57 schrieb Graeme Geldenhuys via Lazarus: > On 2017-05-07 09:10, Florian Klaempfl via Lazarus wrote: >>> Yeah, that would be the logical thing to do. >> >> Why? What makes a string literal UTF-8? >> > > As Mattias said, the fact that the source unit is UTF-8 encoded. > Defined

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Sven Barth via Lazarus
Am 07.05.2017 12:07 schrieb "Florian Klaempfl via Lazarus" < lazarus@lists.lazarus-ide.org>: > > Am 07.05.2017 um 11:57 schrieb Graeme Geldenhuys via Lazarus: > > On 2017-05-07 09:10, Florian Klaempfl via Lazarus wrote: > >>> Yeah, that would be the logical thing to do. > >> > >> Why? What makes a

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Graeme Geldenhuys via Lazarus
On 2017-05-07 09:10, Florian Klaempfl via Lazarus wrote: >> Yeah, that would be the logical thing to do. > > Why? What makes a string literal UTF-8? > As Mattias said, the fact that the source unit is UTF-8 encoded. Defined by a BOM marker, or -Fcutf8 or {$codepage utf8}. If the source unit is U

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Florian Klaempfl via Lazarus
Am 07.05.2017 um 10:30 schrieb Mattias Gaertner via Lazarus: > On Sun, 7 May 2017 10:10:26 +0200 > Florian Klaempfl via Lazarus wrote: > >> Am 05.05.2017 um 13:35 schrieb Graeme Geldenhuys via Lazarus: >>> On 2017-05-05 12:17, Mattias Gaertner via Lazarus wrote: I wonder if it would help i

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Mattias Gaertner via Lazarus
On Sun, 7 May 2017 10:10:26 +0200 Florian Klaempfl via Lazarus wrote: > Am 05.05.2017 um 13:35 schrieb Graeme Geldenhuys via Lazarus: > > On 2017-05-05 12:17, Mattias Gaertner via Lazarus wrote: > >> I wonder if it would help if FPC would store UTF-8 string literals as > >> UTF-8 > > > > Ye

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-07 Thread Florian Klaempfl via Lazarus
Am 05.05.2017 um 13:35 schrieb Graeme Geldenhuys via Lazarus: > On 2017-05-05 12:17, Mattias Gaertner via Lazarus wrote: >> I wonder if it would help if FPC would store UTF-8 string literals as >> UTF-8 > > Yeah, that would be the logical thing to do. Why? What makes a string literal UTF-8? >

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 16:36:51 +0300 Juha Manninen via Lazarus wrote: > On Fri, May 5, 2017 at 4:21 PM, Mattias Gaertner via Lazarus > wrote: > > Oops. Which one? > > The FAQ says: > "Since FPC 3.0 you must add the flag -FcUTF8 or add {$codepage UTF8} > at the beginning of the unit." I improved

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 4:21 PM, Mattias Gaertner via Lazarus wrote: > Oops. Which one? The FAQ says: "Since FPC 3.0 you must add the flag -FcUTF8 or add {$codepage UTF8} at the beginning of the unit." The same page in "String Literals" section says: "In most cases {$codepage utf8} / -FcUTF8 is

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 3:56 PM, Sven Barth via Lazarus wrote: > That is mainly due to the compiler not supporting surrogate pairs for the > UTF-8 -> UTF-16 conversion. If it would support them, then there wouldn't be > a problem anymore... That is a serious bug. Getting codepoints right is the ab

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 14:12:05 +0300 Juha Manninen via Lazarus wrote: >[...] > Then Mattias adds FAQs contradicting the earlier texts ... Oops. Which one? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/lis

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Sven Barth via Lazarus
Am 05.05.2017 13:50 schrieb "Juha Manninen via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On Fri, May 5, 2017 at 2:29 PM, Michael Van Canneyt via Lazarus > wrote: > > Then what is still the problem ? > > With BOM you get: > Error: UTF-8 code greater than 65535 found > which is counter-intuiti

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 12:49, Juha Manninen via Lazarus wrote: > A wrong information easily propagates, thus it is important to get this right. No worries, I agree. Thanks for correcting my terminology. Regards, Graeme -- ___ Lazarus mailing list Lazarus@lis

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 2:02 PM, Graeme Geldenhuys via Lazarus wrote: > If so, when why does LCL also call the above two functions? Graeme, they are called by LazUtils package, LazUTF8 unit, not by LCL. It is not limited to GUI programming. A wrong information easily propagates, thus it is importa

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 2:29 PM, Michael Van Canneyt via Lazarus wrote: > Then what is still the problem ? With BOM you get: Error: UTF-8 code greater than 65535 found which is counter-intuitive when the file and the string literal are both UTF-8. It is related to changing the default codepage at

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 13:02, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 10:41, Ondrej Pokorny via Lazarus wrote: Just use "DefaultSystemCodePage := CP_UTF8" and every single-byte string is unicode enabled. So does that mean you don't have to also call the following two functions (which LCL doe

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 12:17, Mattias Gaertner via Lazarus wrote: > I wonder if it would help if FPC would store UTF-8 string literals as > UTF-8 Yeah, that would be the logical thing to do. FPC not doing that is what really confused me. Regards, Graeme --

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Mattias Gaertner via Lazarus wrote: On Fri, 5 May 2017 12:52:48 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: [...] I propose to let the compiler observe the BOM. But I don't think more is needed. FPC observes the BOM. Same as Delphi. Then what is still the pr

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 12:52:48 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: >[...] > I propose to let the compiler observe the BOM. > But I don't think more is needed. FPC observes the BOM. Same as Delphi. I wonder if it would help if FPC would store UTF-8 string literals as UTF-8 and how

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Schnell via Lazarus
On 05.05.2017 12:16, Graeme Geldenhuys via Lazarus wrote: In the end it’s about supporting Unicode. Does it really matter what internal encoding it is to achieve the “Unicode support” goal? Yep it does. There are ways around that issue (i.e. code aware strings) but in fact these trigger a new

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 11:55, Jürgen Hestermann via Lazarus wrote: > I use UTF-8 internally and > convert to/from UTF-16 for all Windows API functions and > I never found any problem with it. > The time that the API functions requires is so much longer than the > time for string conversion that it does not

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 1:20 AM, Graeme Geldenhuys via Lazarus wrote: > A case in point. Looking at the Wiki page you listed, I read the following: > " > Since FPC 3.0 you must add the flag -FcUTF8 or add {$codepage UTF8} at the > beginning of the unit. > ... Uhhh, the same page in "String Litera

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 10:41, Ondrej Pokorny via Lazarus wrote: > Just use "DefaultSystemCodePage := CP_UTF8" and every single-byte string > is unicode enabled. So does that mean you don't have to also call the following two functions (which LCL does). SetMultiByteConversionCodePage(CP_UTF8); SetMulti

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 12:55, Jürgen Hestermann via Lazarus wrote: A situation where it may be a problem is when reading (UTF-16 encoded) text files. No, not at all. If you convert the file on the fly, there is almost 0 performance penalty. Ondrej -- ___ La

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 12:01, Michael Van Canneyt via Lazarus wrote: On Fri, 5 May 2017, Ondrej Pokorny via Lazarus wrote: Believe me, I use it in production without any problems: I have unicode-aware TStrings, I can read files with unicode names, I can do everything with plain FPC trunk. I am aware o

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Jürgen Hestermann via Lazarus
Am 2017-05-05 um 12:16 schrieb Graeme Geldenhuys via Lazarus: > In the end it’s about supporting Unicode. Does it really matter > what internal encoding it is to achieve the “Unicode support” > goal? From a performance perspective it may be unwanted to convert string encodings back and forth all

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Juha Manninen via Lazarus wrote: On Fri, May 5, 2017 at 9:43 AM, Michael Van Canneyt via Lazarus wrote: What tricks do you still need in 3.0.x ? The annoying tricky part with our UTF-8 solution is the assignment of Unicode string literals. With UTF-8 BOM it does not wor

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Juha Manninen via Lazarus
On Fri, May 5, 2017 at 9:43 AM, Michael Van Canneyt via Lazarus wrote: > What tricks do you still need in 3.0.x ? The annoying tricky part with our UTF-8 solution is the assignment of Unicode string literals. With UTF-8 BOM it does not work at all, as discussed here. Without BOM it depends on str

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 12:17:22 +0200 Ondrej Pokorny via Lazarus wrote: >[...] > Embarcadero realized they made a mistake when they disabled (yes, only > disabled not removed) 8-byte strings from NEXTGEN compilers. UTF8String > and RawByteString are back for all NEXTGEN compilers since 10.1. You ca

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 12:01:47 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: >[...] > > Believe me, I use it in production without any problems: I have > > unicode-aware TStrings, I can read files with unicode names, I can do > > everything with plain FPC trunk. > > I am aware of this, I

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 12:08, Mattias Gaertner via Lazarus wrote: On Fri, 5 May 2017 10:56:41 +0100 Graeme Geldenhuys via Lazarus wrote: [...] or work with large amount of 8-bit strings. Why would you want to? Unicode supports all languages, Maybe there is a misunderstanding. Let me rephrase my ques

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 11:01, Michael Van Canneyt via Lazarus wrote: > We claim Delphi compatibility. > So IMHO we must provide a UTF-16 Delphi compatible RTL. In the end it’s about supporting Unicode. Does it really matter what internal encoding it is to achieve the “Unicode support” goal? Regards, G

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 10:56:41 +0100 Graeme Geldenhuys via Lazarus wrote: >[...] > > or work with large amount of 8-bit strings. > > Why would you want to? Unicode supports all languages, Maybe there is a misunderstanding. Let me rephrase my question: What string do you use in Linux Delphi when

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Ondrej Pokorny via Lazarus wrote: On 05.05.2017 11:23, Michael Van Canneyt via Lazarus wrote: Yes, this somewhat alleviates the problem; but this still is a single-byte TStrings, as opposed to the WideString TStrings of Delphi. It's also still a single-byte filename argum

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 10:41, Mattias Gaertner via Lazarus wrote: > I wonder what they do when you need to access the raw 8-bit file names, OSX, iOS, Android and Linux all use UTF-8 as standard, so filename access is not going to be any problem. Windows is moving more and more towards UTF-16 everywhere, s

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 10:01:24 +0100 Graeme Geldenhuys via Lazarus wrote: >[...] > > AFAIK you are using UTF-8 in AnsiString in FPC 2.6.4. That works in > > many cases, because of double fooling the compiler. This trick does not > > work on Windows with RTL file functions though. > > Yes and true

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 11:23, Michael Van Canneyt via Lazarus wrote: Yes, this somewhat alleviates the problem; but this still is a single-byte TStrings, as opposed to the WideString TStrings of Delphi. It's also still a single-byte filename argument. Yes but you forget that unicode is also single-byte

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Ondrej Pokorny via Lazarus wrote: On 05.05.2017 11:17, Michael Van Canneyt via Lazarus wrote: On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: As far as I know, you don't need any tricks to work with un

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 11:24, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 10:17, Michael Van Canneyt via Lazarus wrote: Something like: sl.LoadFromFile('some_utf8_file.txt', CP_UTF8); sl.LoadFromFile('some_utf16_file.txt', CP_UTF16); sl.LoadFromFile('some_latin1_file.txt', CP_Latin1); Not

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 10:17, Michael Van Canneyt via Lazarus wrote: >> Something like: >> >> sl.LoadFromFile('some_utf8_file.txt', CP_UTF8); >> sl.LoadFromFile('some_utf16_file.txt', CP_UTF16); >> sl.LoadFromFile('some_latin1_file.txt', CP_Latin1); > > Not yet. These are the exceptions I was talking ab

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 10:17, Michael Van Canneyt via Lazarus wrote: Something like: sl.LoadFromFile('some_utf8_file.txt', CP_UTF8); sl.LoadFromFile('some_utf16_file.txt', CP_UTF16); sl.LoadFromFile('some_latin1_file.txt', CP_Latin1); Not

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 10:17, Ondrej Pokorny via Lazarus wrote: > I don't know about 3.0.x but you can do it in trunk 3.1.1. I posted a > patch for it (r34475). Fantastic! Glad to see somebody was thinking in the same train of thought as I did. :) Is that scheduled to be back-ported to FPC 3.0.x? Regar

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 11:17, Michael Van Canneyt via Lazarus wrote: On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: As far as I know, you don't need any tricks to work with unicode filenames or output in 3.0.2. Maybe with exception o

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Ondrej Pokorny via Lazarus wrote: On 05.05.2017 11:06, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: As far as I know, you don't need any tricks to work with unicode filenames or output in 3.0.2. Maybe with exception of T

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 09:59, Michael Schnell via Lazarus wrote: > (Most obvious drawback: not flexibly typed TStrings.) I know not everybody likes Generics, but that is where I see Generics could come in very handy. A single TStrings implementation that supports multiple string types. Or just implement a

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: As far as I know, you don't need any tricks to work with unicode filenames or output in 3.0.2. Maybe with exception of TStrings and TFileStream. Again, I didn't have time to

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Ondrej Pokorny via Lazarus
On 05.05.2017 11:06, Graeme Geldenhuys via Lazarus wrote: On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: As far as I know, you don't need any tricks to work with unicode filenames or output in 3.0.2. Maybe with exception of TStrings and TFileStream. Again, I didn't have time to fol

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 09:31, Kostas Michalopoulos via Lazarus wrote: > After all, BMP does include practically all languages used today. The bottom line: Unicode Standard <> BMP only! If you think that, then rather promote your application as a UCS-2 compliant application, not a Unicode compliant app

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote: > As far as I know, you don't need any tricks to work with unicode > filenames or output in 3.0.2. Maybe with exception of TStrings and > TFileStream. Again, I didn't have time to follow FPC 3.x development much, and I was too confused wi

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Graeme Geldenhuys via Lazarus
On 2017-05-05 00:15, Mattias Gaertner via Lazarus wrote: > I added a FAQ: > http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus#What_happens_when_I_use_.24codepage_utf8.3F Ah, thanks for that explanation. > AFAIK you are using UTF-8 in AnsiString in FPC 2.6.4. That works in > many cas

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Michael Schnell via Lazarus
On 04.05.2017 16:56, Juha Manninen via Lazarus wrote: I believe everybody is happy to get rid of the horrendous Windows If if this is true, there is a decent need for backwards compatibility. That is why, theoretically, code aware strings is a good idea. Unfortunately the implementation of thos

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Mattias Gaertner via Lazarus
On Fri, 5 May 2017 11:31:00 +0300 Kostas Michalopoulos via Lazarus wrote: >[...] > To play the devil's advocate, the fact that ALL reviews said that it has > excellent support for Unicode means that characters outside the BMP *are* > rare. After all, BMP does include practically all languages use

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-05 Thread Kostas Michalopoulos via Lazarus
On Thu, May 4, 2017 at 8:53 PM, Graeme Geldenhuys via Lazarus < lazarus@lists.lazarus-ide.org> wrote: > On 2017-05-04 15:56, Juha Manninen via Lazarus wrote: > > I have seen comments saying that treating UTF-16 as fixed width > > encoding is OK because the characters outside BMP are so rare. It is

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Michael Van Canneyt via Lazarus
On Fri, 5 May 2017, Mattias Gaertner via Lazarus wrote: I simply can't see myself moving past FPC 2.6.4 at this point. FPC 3.x just doesn't make any sense. AFAIK you are using UTF-8 in AnsiString in FPC 2.6.4. That works in many cases, because of double fooling the compiler. This trick does

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Mattias Gaertner via Lazarus
On Thu, 4 May 2017 23:20:33 +0100 Graeme Geldenhuys via Lazarus wrote: >[...] > Since FPC 3.0 you must add the flag -FcUTF8 or add {$codepage UTF8} at the > beginning of the unit. > > * Note: This changes all string literals to UTF-16, increasing the size of > the binary and slowing it down.

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Graeme Geldenhuys via Lazarus
On 2017-05-04 21:53, Juha Manninen via Lazarus wrote: > It is briefly explained here: I haven't been following FPC 3.x development much because I think the Unicode changes are terribly confusing. A case in point. Looking at the Wiki page you listed, I read the following: " Since FPC 3.0 you mus

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Juha Manninen via Lazarus
On Thu, May 4, 2017 at 8:53 PM, Graeme Geldenhuys via Lazarus wrote: > You made me curious, so I want to take a look. Hopefully it doesn’t > depend too heavily on the rest of LCL, so I’ll be able to use it in > other projects of mine. It has no dependency for LCL, it is part of LazUtils package j

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Graeme Geldenhuys via Lazarus
On 2017-05-04 15:56, Juha Manninen via Lazarus wrote: > I have seen comments saying that treating UTF-16 as fixed width > encoding is OK because the characters outside BMP are so rare. It is > like saying that a buggy spreadsheet app is OK because it calculates > the sums wrong only sometimes. I

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread wkitty42--- via Lazarus
On 05/04/2017 10:56 AM, Juha Manninen via Lazarus wrote: On Thu, May 4, 2017 at 2:47 PM, wkitty42--- via Lazarus wrote: On 05/03/2017 05:21 AM, Juha Manninen via Lazarus wrote: Encoding does not matter any more, as long as it is Unicode. reminds me of a saying that is attributed to Henry For

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Juha Manninen via Lazarus
On Thu, May 4, 2017 at 2:47 PM, wkitty42--- via Lazarus wrote: > On 05/03/2017 05:21 AM, Juha Manninen via Lazarus wrote: >> Encoding does not matter any more, as long as it is Unicode. > > reminds me of a saying that is attributed to Henry Ford... > Any customer can have a car painted any color t

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread wkitty42--- via Lazarus
On 05/03/2017 05:21 AM, Juha Manninen via Lazarus wrote: Encoding does not matter any more, as long as it is Unicode. reminds me of a saying that is attributed to Henry Ford... Any customer can have a car painted any color that he wants so long as it is black. :) -- NOTE: No off-list as

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Mattias Gaertner via Lazarus
On Thu, 4 May 2017 09:56:18 +0100 Tony Whyman via Lazarus wrote: >[...] > I don't believe that string indexing even works for UTF8 strings at > present - at least not in a simple s[i] way. It exists the same as for UTF-16 strings. > Is it really that much overhead to have a simple codepage c

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Graeme Geldenhuys via Lazarus
On 2017-05-04 09:56, Tony Whyman via Lazarus wrote: > I don't believe that string indexing even works for UTF8 strings at > present - at least not in a simple s[i] way. It's simple, STOP using index arrays into strings. It doesn't work for Unicode! Use specialised code-point iterators or somethin

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Graeme Geldenhuys via Lazarus
On 2017-05-04 10:15, Graeme Geldenhuys via Lazarus wrote: > * A "character seen on the screen" could be made up of multiple code > points. eg: U+0065 (e) + U+0302 (^) gives you ê. So it might look like > one "character", it is *not*. Applying better typography to that representation would yield:

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Tony Whyman via Lazarus
On 03/05/17 17:53, Sven Barth via Lazarus wrote: Am 03.05.2017 14:37 schrieb "Tony Whyman via Lazarus" mailto:lazarus@lists.lazarus-ide.org>>: > On the other hand, AnsiString and UnicodeString are still separate types. Why? Why should there not be a single unified string type with (e.g.) ASCI

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-04 Thread Juha Manninen via Lazarus
On Thu, May 4, 2017 at 12:55 AM, Graeme Geldenhuys via Lazarus wrote: > On 2017-05-03 20:47, Juha Manninen via Lazarus wrote: >> If you share and edit the sources between Delphi and Lazarus then you >> cannot use the full Unicode. > > Quite comical considering that the FPC team always makes such a

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 9:37 AM, Mattias Gaertner via Lazarus wrote: >> Hmmm... why does FPC not understand the BOM? > > It does. And so does Delphi. But with and without BOM have different > meanings. > > >> > You are right, that using Unicode with Lazarus only needs a couple of >> > rules to foll

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 6:13 AM, Ondrej Pokorny via Lazarus wrote: > Not if you need pre-unicode Delphi support :) > > (Well, Marcos didn't specify what Delphi version he wants to target but he > stated "If Delphi sources don't use UTF8 [...]", which applies to > pre-unicode Delphi versions.) Yeah

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Graeme Geldenhuys via Lazarus
On 2017-05-03 20:47, Juha Manninen via Lazarus wrote: > If you share and edit the sources between Delphi and Lazarus then you > cannot use the full Unicode. Quite comical considering that the FPC team always makes such a big fuss about "we want Delphi compatibility", and now it seems to be worse

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Sven Barth via Lazarus
On 03.05.2017 21:47, Juha Manninen via Lazarus wrote: > Why Delphi adds the BOM? Why can't it just read the file and > understand it is UTF-8? Probably for the same reason as FPC: the default code page if no BOM is available and no command line option is set and no $codepage directive is found is

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Ondrej Pokorny via Lazarus
On 03.05.2017 21:47, Juha Manninen via Lazarus wrote: How many people are editing their sources in both Delphi and Lazarus? Me, but I keep the files ASCII-only because I need to target all Delphi versions down to D5 :/ My customers really demand it, unfortunately. I'd like to kill these dinos

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Juha Manninen via Lazarus
On Wed, May 3, 2017 at 12:03 PM, Juha Manninen wrote: > Marcos Douglas B. Santos wrote: >> But if I put theses constants as resourcestrings, it's Ok as Mattias >> told me, right? > > I don't think it makes any difference. You can use the full Unicode in > both cases. I stand corrected. If you sha

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Sven Barth via Lazarus
Am 03.05.2017 14:37 schrieb "Tony Whyman via Lazarus" < lazarus@lists.lazarus-ide.org>: > On the other hand, AnsiString and UnicodeString are still separate types. Why? Why should there not be a single unified string type with (e.g.) ASCII, UTF8 and UTF-16 (or MS Unicode) being just another code pa

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Sven Barth via Lazarus
Am 03.05.2017 11:34 schrieb "Graeme Geldenhuys via Lazarus" < lazarus@lists.lazarus-ide.org>: > For example, take a look at ConEmu for Windows. > * Tab support built-in > * Resizeable console windows While not point and click you can resize console windows (and the window buffer) without probl

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Graeme Geldenhuys via Lazarus
On 2017-05-03 13:37, Tony Whyman via Lazarus wrote: > Is Delphi/FPC string handling that much worse than 'C'? I can’t answer about C, but compared to Java and Qt’s solution, Delphi and FPC’s solutions are terrible and very confusing. Regards, Graeme --

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Martok via Lazarus
Am 03.05.2017 um 11:03 schrieb Juha Manninen via Lazarus: > How could this thing be communicated so that people understand? It would probably help if there weren't three different pages about "Unicode Support" on the wiki, all saying slightly different and conflicting things (because they talk abou

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Mattias Gaertner via Lazarus
On Wed, 3 May 2017 13:37:24 +0100 Tony Whyman via Lazarus wrote: >[...] > On the other hand, AnsiString and UnicodeString are still separate > types. Why? Why should there not be a single unified string type with > (e.g.) ASCII, UTF8 and UTF-16 (or MS Unicode) being just another code page? Man

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Tony Whyman via Lazarus
On 03/05/17 09:52, Graeme Geldenhuys via Lazarus wrote: [rant] ps: Both FPC and Delphi is in such a messed up state when it comes to string and character types. It is the laughing stock of programming languages at the moment. At least EMBT is heading in the right direction with their

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Mattias Gaertner via Lazarus
On Wed, 3 May 2017 15:15:53 +0300 Juha Manninen via Lazarus wrote: >[...] > > Back in Lazarus compiling such a file gives the error: > > LazUnicodeTest.lpr(28,10) Error: UTF-8 code greater than 65535 found > > Äh, I did not test moving it back to Lazarus. Well, that's the point of sharing cod

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 5:59 AM, Graeme Geldenhuys via Lazarus wrote: > On 2017-05-03 01:21, Marcos Douglas B. Santos via Lazarus wrote: >> Sorry about that. I stopped using Delphi at version 7, that uses ANSI. >> I thought that Delphi nowadays was using UTF16. > > They (Delphi) loves to follow Mic

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Juha Manninen via Lazarus
On Wed, May 3, 2017 at 2:43 PM, Mattias Gaertner via Lazarus wrote: > First it did not compile in Delphi, because of an unsupported inline. I > fix that with an IFDEF FPC. Right, I had added that after testing with Delphi. The inline looks good to me, don't know why Delphi does not like it. > Th

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Mattias Gaertner via Lazarus
On Wed, 3 May 2017 12:03:41 +0300 Juha Manninen via Lazarus wrote: >[...] > Please also look at program LazUnicodeTest in components/lazutils/test/. > It does advanced Unicode stuff and works in both Delphi and Lazarus. I tried it: First it did not compile in Delphi, because of an unsupported i

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Mattias Gaertner via Lazarus
On Wed, 3 May 2017 12:03:41 +0300 Juha Manninen via Lazarus wrote: >[...] > Mattias Gaertner wrote: > > Option a) You can use English in sources and load all non ASCII > > constants via resourcestrings or similar. Then the codepage is > > irrelevant. > > Option b) You can store all files as UTF-8

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Jürgen Hestermann via Lazarus
Am 2017-05-03 um 11:34 schrieb Graeme Geldenhuys via Lazarus: > I don't know why anybody would still want to run the standard Windows > console - it is 20 years behind everybody else. The reason: It is available on every Windows machine. The alternatives need to be installed first so scripts desi

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Juha Manninen via Lazarus
On Wed, May 3, 2017 at 12:13 PM, Ondrej Pokorny via Lazarus wrote: > Not if you need pre-unicode Delphi support :) Ok, true. IMO such old Delphi versions should not be used any more for new code. Maintenance tasks only I think. Fortunately there is again a free Delphi Starter edition. It means a

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Ondrej Pokorny via Lazarus
On 03.05.2017 11:21, Juha Manninen via Lazarus wrote: Windows already supports Unicode in everything ... except for console output! Why is that? You can start the console with UTF-8 codepage: http://stackoverflow.com/questions/14109024/how-to-make-unicode-charset-in-cmd-exe-by-default Then y

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Graeme Geldenhuys via Lazarus
On 2017-05-03 10:25, Ondrej Pokorny via Lazarus wrote: > You can start the console with UTF-8 codepage: > http://stackoverflow.com/questions/14109024/how-to-make-unicode-charset-in-cmd-exe-by-default > > Then you have full unicode (utf-8) support. Or use the much better console alternatives. The

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Juha Manninen via Lazarus
On Wed, May 3, 2017 at 11:52 AM, Graeme Geldenhuys via Lazarus wrote: > At least EMBT is heading in the right direction with their > Linux Delphi compiler - they completely removed AnsiString. I must agree with you. I hope it will be removed in (far) future when nobody uses the old Windows system

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Ondrej Pokorny via Lazarus
On 03.05.2017 11:03, Juha Manninen via Lazarus wrote: I am puzzled why there were so many misleading and confusing replies, also from knowledgeable Lazarus developers. Remember, the question was about making sources compatible with Delphi. The person (Marcos Douglas) did not know details of how s

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Juha Manninen via Lazarus
Marcos Douglas B. Santos wrote: > I am develop on Windows. What problems do you mean? Unicode is recommended also on Windows. No worries. You don't need to use the old system codepages. People who need them must convert them explicitly because the Unicode system of Lazarus does not support them di

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Graeme Geldenhuys via Lazarus
On 2017-05-03 01:21, Marcos Douglas B. Santos via Lazarus wrote: > Sorry about that. I stopped using Delphi at version 7, that uses ANSI. > I thought that Delphi nowadays was using UTF16. They (Delphi) loves to follow Microsoft. Files are stored in UTF-8 (this is the norm), but they use UTF-16 int

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Graeme Geldenhuys via Lazarus
On 2017-05-02 09:30, Juha Manninen via Lazarus wrote: > From FPC's point of view our UTF-8 solution is a hack. FPC's point of view or Marco's point of view? Just curious - so what is FPC’s “correct” solution then for using UTF-8 and the preferred encoding? What's the alternative they offer? [ra

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Marcos Douglas B. Santos via Lazarus
On Tue, May 2, 2017 at 5:30 AM, Juha Manninen via Lazarus wrote: >>> 1. Assign a constant always to a type String variable. >> >> What do you mean? Instead of create a constant, is it better create a >> String variable and assign the string to it? > > From FPC's point of view our UTF-8 solution i

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Marcos Douglas B. Santos via Lazarus
On Tue, May 2, 2017 at 5:58 AM, Juha Manninen via Lazarus wrote: > On Sun, Apr 30, 2017 at 7:37 PM, Marcos Douglas B. Santos via Lazarus > wrote: >> If Delphi sources don't use UTF8, how is the best way to mantain sources >> that need to work in both compilers? > > I wonder if I have misunderstoo

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Juha Manninen via Lazarus
On Sun, Apr 30, 2017 at 7:37 PM, Marcos Douglas B. Santos via Lazarus wrote: > If Delphi sources don't use UTF8, how is the best way to mantain sources > that need to work in both compilers? I wonder if I have misunderstood something about your questions. What means "Delphi sources don't use UTF8

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Juha Manninen via Lazarus
On Tue, May 2, 2017 at 2:30 AM, Marcos Douglas B. Santos via Lazarus wrote: > So, as Mattias said, we should code using ANSI chars and everything will be > Ok. No, you can use all the Unicode freely. The source files are saved as UTF-8 by default. Delphi does the same, this detail is also compat

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-01 Thread Marcos Douglas B. Santos via Lazarus
On Mon, May 1, 2017 at 11:06 AM, Juha Manninen via Lazarus wrote: > On Mon, May 1, 2017 at 12:30 PM, Tony Whyman via Lazarus > ... > > No! The good idea is to use "String". I agree. >> 5. Take care when using string literals. >> I added >> {$IFDEF FPC} >> {$codepage UTF8} >> {$ENDIF} > > Yes, st

Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-01 Thread Marcos Douglas B. Santos via Lazarus
On Mon, May 1, 2017 at 8:47 AM, Mattias Gaertner via Lazarus wrote: > Option a) You can use English in sources and load all non ASCII > constants via resourcestrings or similar. Then the codepage is > irrelevant. > Option b) You can store all files as UTF-8 with BOM. Then FPC will > store all non

  1   2   >