Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-07

Unicode RTL

16 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

I have just completed phase one of the "Unicode RTL" effort.

The 'Unicode RTL' is an effort to be more Delphi compatible:
- Char = Unicode Char and String = UnicodeString
- Provide dotted filenames.
Basically closer to the RTL as it exists in more recent versions of Delphi (essentially post - Delphi 2009)

This RTL will co-exist with the current RTL (single-byte char, no dotted names), but will share the same codebase.

More explanations can be found here:

https://wiki.freepascal.org/FPC_Unicode_RTL

This coexistence of 2 RTLs is accomplished with 'Subtarget support'.

Subtarget support is a means to consistently apply a set of Free Pascal compiler settings to everything that you compile.

Subtarget support is explained in more detail here: https://wiki.freepascal.org/FPC_Subtarget_Support

While it is now used to create a unicode rtl, it could also be used to

* create a llvm-compiled RTL.
* create an rtl with debug info and one without.
* compile the various Lazarus widgetsets into different directories
* ... any other things you may think of ...

all with a single installation of FPC.

For the second part of the effort, 'provide dotted filenames', the actual work is finished, but still needs merging to trunk.

This second part is expected to be merged in the next days/weeks.

But today, using FPC trunk, you can now recompile the Free Pascal RTL, Packages and Utils (but not the compiler itself!) into a set of units where

Char = UnicodeChar
String = UnicodeString

To compile (and install) the unicode rtl, all you need to do is follow the steps outlined in

https://wiki.freepascal.org/FPC_Unicode_RTL

Basically, this means creating a 2-line configuration file for the unicodertl subtarget, and compiling the RTL, packages and utils with

make SUB_TARGET=unicodertl

For those that need/want more delphi-compatible code, I would love to hear of your experience with the unicode rtl. I have done extensive testing, but as practice shows, there will always be cases which defy ordinary test cases...

If the 2 wiki pages need more explanations, please let me know and I will do my best to improve the explanations.

Hopefully, in the near future the compiler settings dialog in Lazarus will also allow you to specify a subtarget.

Michael.

Reply by email

Michael Van Canneyt
Kirinn wrote
Hi, A "unicode" RTL is of course great for targeting legacy Windows platforms, but for those of us on Linux, UTF-8 is the way.

It is not only for legacy windows platforms.
The target platform is secondary.

What to use depends more on your codebase than on your target platform. There is a lot of Delphi code out there that assumes that string=unicodestring.

If, like my current company, you have a large Delphi application that you wish to run on linux, then you may be better off with a unicode RTL.

To this end, it would be helpful to add a paragraph on the wiki page underlining how to retain the single-byte RTL; or, if no user action is necessary, mention that, to set you for this hard work!

No user action is necessary.

But your advice is good: I have added this to the page, and made clear that the RTL as it currently exists, is still the default RTL.

Michael.

Reply by email

Luca Olivetti
to Michael Van Canneyt

El 24/7/23 a les 23:20, Michael Van Canneyt via lazarus ha escrit:

Show quoted text 10 lines
> To this end, it would be > helpful to add a paragraph on the wiki page underlining how to retain the > single-byte RTL; or, if no user action is necessary, mention that, to set > you for this hard work! No user action is necessary. But your advice is good: I have added this to the page, and made clear that the RTL as it currently exists, is still the default RTL.

So those of us that don't need delphi compatibility can be sure that nothing will break?

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Michael Van Canneyt
to Luca Olivetti
Luca Olivetti wrote 15 lines
El 24/7/23 a les 23:20, Michael Van Canneyt via lazarus ha escrit: > >> To this end, it would be >> helpful to add a paragraph on the wiki page underlining how to retain the >> single-byte RTL; or, if no user action is necessary, mention that, to set >> you for this hard work! > > No user action is necessary. > > But your advice is good: I have added this to the page, and made clear > that the RTL as it currently exists, is still the default RTL. So those of us that don't need delphi compatibility can be sure that nothing will break?

Unless I unwittingly introduced a bug somewhere (gods forbid ;)), nothing will break.

Backwards compatibility is and remains important.

Michael.

Reply by email

Michael Van Canneyt
Adriaan van Os wrote 8 lines
Michael Van Canneyt via fpc-devel wrote: > > Hello, > > I have just completed phase one of the "Unicode RTL" effort. I object to the name "Unicode" RTL. Where people talk about what they call "Unicode" they usually mean UCS-16 or UTF-16 or UTF-16-mishandled-as-UCS16.

Objection duly noted.

Michael.

Reply by email

Michael Van Canneyt
to Alexey Torgashin
Alexey Torgashin wrote 5 lines
> Objection duly noted. Yes, 'Unicode RTL' sounds very bad. Before it was Unicode too. So, "UTF16 RTL", "WideChar RTL" or so.

The "Unicode" refers to String = UnicodeString.

The latter has been in use for what, 15-20 years ?

The name is chosen to remain consistent with existing terminology.

Assuming you guys are consistent, I guess you people are also not comfortable with the term 'UnicodeString' ?

Working with FPC must be a really annoying experience then...

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Michael Van Canneyt wrote 13 lines
On Fri, 28 Jul 2023, Alexey Torgashin via lazarus wrote: > >> Objection duly noted. > > Yes, 'Unicode RTL' sounds very bad. Before it was Unicode too. So, > "UTF16 RTL", "WideChar RTL" or so. The "Unicode" refers to String = UnicodeString. The latter has been in use for what, 15-20 years ?

...wrong for 20 years.

The name is chosen to remain consistent with existing terminology.

It seems, it was chosen because it is easier to pronounce than UTF16 RTL.

Naming something Unicode without adding any new Unicode feature can hardly be called consistent.

Assuming you guys are consistent, I guess you people are also not comfortable with the term 'UnicodeString' ?

Of course not.

Working with FPC must be a really annoying experience then...

;)

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 22 lines
On 28.07.23 13:42, Michael Van Canneyt via lazarus wrote: > > > On Fri, 28 Jul 2023, Alexey Torgashin via lazarus wrote: > >> >>> Objection duly noted. >> >> Yes, 'Unicode RTL' sounds very bad. Before it was Unicode too. So, "UTF16 >> RTL", "WideChar RTL" or so. > > The "Unicode" refers to String = UnicodeString. > > The latter has been in use for what, 15-20 years ? ...wrong for 20 years. > > The name is chosen to remain consistent with existing terminology. It seems, it was chosen because it is easier to pronounce than UTF16 RTL.

No, see below (or above).

Naming something Unicode without adding any new Unicode feature can hardly be called consistent.

As I wrote, the "Unicode" refers to String = UnicodeString. In that sense it is 'consistent with existent terminology'

That the original terminology "unicodestring" is badly chosen, see first line in the feature list:

https://delphi.embarcadero.com/project/delphi-2009/

So complaints to CodeGear, please.

But if all these terribly unhappy and depressed users have a better name, I'm all ears.

So far, nothing catchy has been offered.

We'll attribute this lack of creativity to the state of depression due to having to use such awful and horrifying terminology for ~15 years ;-)

Michael.

Reply by email

Luca Olivetti
to Michael Van Canneyt

El 28/7/23 a les 16:35, Michael Van Canneyt via lazarus ha escrit:

But if all these terribly unhappy and depressed users have a better name, I'm all ears. So far, nothing catchy has been offered.

What about "Futura RTL"?
Short, catchy and...completely meaningless in this context :-D

Great song, though
https://www.youtube.com/watch?v=RXjE4q3Hyd4

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Michael Van Canneyt: No, see below (or above). As I wrote, the "Unicode" refers to String = UnicodeString. In…
Michael Van Canneyt wrote 6 lines
[...] > Naming something Unicode without adding any new Unicode feature can > hardly be called consistent. As I wrote, the "Unicode" refers to String = UnicodeString. In that sense it is 'consistent with existent terminology'

Yes, but you didn't name it "UnicodeString RTL", you named it "Unicode RTL". You can't blame CodeGear for that choice.

The new RTL has dotted units, so "Namespaced RTL" or "Dotted RTL" would fit too - also no catchy.

So far, nothing catchy has been offered.

If you want something catchy, don't use a descriptive name.

Since the cheetah is a dotted (spotted) animal and it is the fpc mascot, maybe Cheetah RTL?

Mattias

Reply by email

Sergey Bodrov
to Michael Van Canneyt: No, see below (or above). As I wrote, the "Unicode" refers to String = UnicodeString. In…
So far, nothing catchy has been offered.

WideChar RTL

Note, that WinAPI says:
* A Windows code page version with the letter "A" used to indicate "ANSI"
* A Unicode version with the letter "W" used to indicate "wide". so, it perfectly matches AnsiString and WideString. And UnicodeString is just alias for WideString

Also, what about "Delphi RTL"? Especially for Delphi compatibility.

*Bodrov Sergey* software development, IT consulting http://www.serbod.com *Phone (Belarus):* +375(25)794-21-58 *Skype:* sergey.bodrov1 *e-mail:* , -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230728/bb8fff82/attachment.htm>

Reply by email

Michael Van Canneyt
to Sergey Bodrov: WideChar RTL Note, that WinAPI says: * A Windows code page version with the letter "A"…
Sergey Bodrov wrote 14 lines
> > > So far, nothing catchy has been offered. > WideChar RTL Note, that WinAPI says: * A Windows code page version with the letter "A" used to indicate "ANSI" * A Unicode version with the letter "W" used to indicate "wide". so, it perfectly matches AnsiString and WideString. And UnicodeString is just alias for WideString Also, what about "Delphi RTL"? Especially for Delphi compatibility.

No, we discussed this in the core team, we don't want a reference to Delphi.

Michael.

Reply by email

Sven Barth
to Sergey Bodrov: WideChar RTL Note, that WinAPI says: * A Windows code page version with the letter "A"…

Sergey Bodrov via lazarus schrieb am Fr.,
28. Juli 2023, 18:52:

And UnicodeString is just alias for WideString

On Windows UnicodeString is *not* an alias to WideString. There they are two completely different types that happen to both handle string with a element width of 2 and UTF-16 encoding.

Regards,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230729/4ad3a77f/attachment.htm>

Reply by email