Sign in Join

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

Mailing lists / lazarus / 2010-09

rewriting of LConvEncoding

22 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner
to Unknown author
Show quoted text 7 lines
Hello I had some issues with LConvEncoding as I wrote in bugtracker issue #0017212 My mistake was essentially the meaning of character encoding "ANSI". Sorry for that. So I took a deeper view at this unit. It is far not complete concerning existing codepages and support for Unicode.

It's goal is to convert the most common codepages and do the rest with the existing OS libraries (iconv).

A complete conversion unit should be part of FPC.

Show quoted text 5 lines
Further, the implementation with string-based encoding-descriptions is not optimal regarding speed and the possibilty to extend the unit. The encoding and decoding of asian-codepages is really suboptimal. (a fast and dirty performance check showed that it is about 3000 times slower than singlebyte codepages like ISO-8859-1)

True.
And the tables are quite big. Maybe the unit should be splitted into several units.

I would rewrite the entire unit, including most of the codepages from ftp.unicode.org, full support for UTF-8, UTF-16 and UTF-32, including LE and BE variants. And as a further utility, a conversion program for the mentioned codepagefiles, that will create a complete pascal include file with all the necessary tables and conversion functions.

What do you mean with full support for UTF-8, UTF-16 and UTF-32?

Mattias

Reply by email

Unknown author
to Mattias Gaertner

--- Urspr?ngliche Nachricht ---
Von: Mattias Gaertner
An:
Betreff: Re: [Lazarus] rewriting of LConvEncoding

Show quoted text 18 lines
On Mon, 20 Sep 2010 20:51:20 +0200 wrote: > Hello > > I had some issues with LConvEncoding as I wrote in bugtracker issue #0017212 > > My mistake was essentially the meaning of character encoding "ANSI". Sorry for that. > > So I took a deeper view at this unit. It is far not complete concerning existing codepages and support for Unicode. It's goal is to convert the most common codepages and do the rest with the existing OS libraries (iconv). A complete conversion unit should be part of FPC.

I agree, but that should be decided by the core developers.

Show quoted text 15 lines
> Further, the implementation with string-based encoding-descriptions is > not optimal regarding speed and the possibilty to extend the unit. The > encoding and decoding of asian-codepages is really suboptimal. (a fast > and dirty performance check showed that it is about 3000 times slower > than singlebyte codepages like ISO-8859-1) True. And the tables are quite big. Maybe the unit should be splitted into several units.

I think with the rigth datamodel the tables can be reduced a lot in size. But nevertheless, it may be a good idea for those who don't need the asiancodepages.

Show quoted text 12 lines
> I would rewrite the entire unit, including most of the codepages from ftp.unicode.org, full support for UTF-8, UTF-16 and UTF-32, including LE and BE variants. And as a further utility, a conversion program for the mentioned codepagefiles, that will create a complete pascal include file with all the necessary tables and conversion functions. What do you mean with full support for UTF-8, UTF-16 and UTF-32? Mattias

I mean full conversion possibilities between old fashioned codepages and UTF, and between the different UTF-strings, always both directions.

I know that parts of this functionality is also in LCLProc, but it is also not complete.

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 26 lines
--- Urspr?ngliche Nachricht --- Von: Mattias Gaertner An: Betreff: Re: [Lazarus] rewriting of LConvEncoding > On Mon, 20 Sep 2010 20:51:20 +0200 > wrote: > >> Hello >> >> I had some issues with LConvEncoding as I wrote in bugtracker issue > #0017212 >> >> My mistake was essentially the meaning of character encoding > "ANSI". Sorry for that. >> >> So I took a deeper view at this unit. It is far not complete > concerning existing codepages and support for Unicode. > > It's goal is to convert the most common codepages and do the > rest with the existing OS libraries (iconv). > > A complete conversion unit should be part of FPC. I agree, but that should be decided by the core developers.

The core developers do not have a problem with this. Since it is mostly tables anyway, I see no reason not to do it.

Note that FPC does contain a some conversion code in the RTL, see the ucmaps directory and the charset unit.

Michael.

Reply by email

Unknown author
to Michael Van Canneyt

--- Urspr?ngliche Nachricht ---
Von: Michael Van Canneyt
An: Lazarus mailing list
Betreff: Re: [Lazarus] rewriting of LConvEncoding

Show quoted text 39 lines
On Mon, 20 Sep 2010, wrote: > > --- Urspr?ngliche Nachricht --- > Von: Mattias Gaertner > An: > Betreff: Re: [Lazarus] rewriting of LConvEncoding > >> On Mon, 20 Sep 2010 20:51:20 +0200 >> wrote: >> >>> Hello >>> >>> I had some issues with LConvEncoding as I wrote in bugtracker issue >> #0017212 >>> >>> My mistake was essentially the meaning of character encoding >> "ANSI". Sorry for that. >>> >>> So I took a deeper view at this unit. It is far not complete >> concerning existing codepages and support for Unicode. >> >> It's goal is to convert the most common codepages and do the >> rest with the existing OS libraries (iconv). >> >> A complete conversion unit should be part of FPC. > > I agree, but that should be decided by the core developers. The core developers do not have a problem with this. Since it is mostly tables anyway, I see no reason not to do it. Note that FPC does contain a some conversion code in the RTL, see the ucmaps directory and the charset unit. Michae--

The files in ucmaps are the files from ftp.unicode.org that I mentionned.

My opinion is that static tables are smaller and faster than dynamic mappings (especially for the asiancodepages), but memory could be an issue. Perhaps this can be solved by smartlinking.

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Zaher Dirkey
to Unknown author

I use my own units to convert win1256 to utf8 or widestring http://sourceforge.net/projects/minilib/

In directory Unicodes

http://minilib.svn.sourceforge.net/viewvc/minilib/trunk/Unicodes/source/

You can install the and hook it as unicodemanager
e.g.

    ucpInstall(cp1256_mbtowc, cp1256_wctomb, True);

I ported it from libiconv at sourceforge
https://sourceforge.net/projects/libiconv/.
Need some one to port another files.

Zaher Dirkey
Best regards.

Show quoted text 70 lines
--- Urspr?ngliche Nachricht --- Von: Michael Van Canneyt An: Lazarus mailing list Betreff: Re: [Lazarus] rewriting of LConvEncoding > On Mon, 20 Sep 2010, wrote: > > > > > --- Urspr?ngliche Nachricht --- > > Von: Mattias Gaertner > > An: > > Betreff: Re: [Lazarus] rewriting of LConvEncoding > > > >> On Mon, 20 Sep 2010 20:51:20 +0200 > >> wrote: > >> > >>> Hello > >>> > >>> I had some issues with LConvEncoding as I wrote in > bugtracker issue > >> #0017212 > >>> > >>> My mistake was essentially the meaning of character > encoding > >> "ANSI". Sorry for that. > >>> > >>> So I took a deeper view at this unit. It is far not > complete > >> concerning existing codepages and support for Unicode. > >> > >> It's goal is to convert the most common codepages and do the > >> rest with the existing OS libraries (iconv). > >> > >> A complete conversion unit should be part of FPC. > > > > I agree, but that should be decided by the core developers. > > The core developers do not have a problem with this. > Since it is mostly tables anyway, I see no reason not to do it. > > Note that FPC does contain a some conversion code in the RTL, > see the ucmaps directory and the charset unit. > > Michae-- The files in ucmaps are the files from ftp.unicode.org that I mentionned. My opinion is that static tables are smaller and faster than dynamic mappings (especially for the asiancodepages), but memory could be an issue. Perhaps this can be solved by smartlinking. ______________________________________________________ powered by GLOBER.LU Luxembourg Internet Service Provider Hosting. Domain Registration, Webshops, Webdesign, FreeMail ... Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100921/66f42c5f/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Unknown author: An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/laz…

2010/9/20 :

I would rewrite the entire unit

Great, just make sure you take all variables into account:

* code size (check if your tables are smartlinkable. The current ones are)
* speed
* maintenability

Mattias Gaertner wrote
And the tables are quite big. Maybe the unit should be splitted into several units.

In my tests the asian tables are smartlinked and won't be added unless necessary.

Splitting into several units is also possible, but then a registration mechanism should be added.

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Mattias Gaertner: On Mon, 20 Sep 2010 20:51:20 +0200 It's goal is to convert the most common codepages and…
Mattias Gaertner wrote 7 lines
> > So I took a deeper view at this unit. It is far not complete concerning existing codepages and support for Unicode. It's goal is to convert the most common codepages and do the rest with the existing OS libraries (iconv). A complete conversion unit should be part of FPC.

There is charset ?

True. And the tables are quite big. Maybe the unit should be splitted into several units.

Charset already does.

Reply by email

Marco van de Voort
to Unknown author: --- Urspr?ngliche Nachricht --- Von: Michael Van Canneyt An: Lazarus mailing list…
Show quoted text 8 lines
> Note that FPC does contain a some conversion code in the RTL, > see the ucmaps directory and the charset unit. The files in ucmaps are the files from ftp.unicode.org that I mentionned. My opinion is that static tables are smaller and faster than dynamic mappings (especially for the asiancodepages), but memory could be an issue. Perhaps this can be solved by smartlinking.

Explain static/dynamic in this context. Note that there is a tool to change the conversions into tables, so they can be linked in, already.

Reply by email

Guy Fink

--- Urspr?ngliche Nachricht ---
Von: Felipe Monteiro de Carvalho
An: , Lazarus mailing list
Betreff: Re: [Lazarus] rewriting of LConvEncoding

Show quoted text 24 lines
2010/9/20 : > I would rewrite the entire unit Great, just make sure you take all variables into account: * code size (check if your tables are smartlinkable. The current ones are) * speed * maintenability On Mon, Sep 20, 2010 at 10:16 PM, Mattias Gaertner wrote: > And the tables are quite big. Maybe the unit should be splitted into > several units. In my tests the asian tables are smartlinked and won't be added unless necessary. Splitting into several units is also possible, but then a registration mechanism should be added. -- Felipe Monteiro de Carvalho

My first idea of the structure then:

A ConvertEncoding-unit, containing all the necessary types,constants, function prototypes and the Unicodestuff. (conversions between the different UTF-variants). It could hold some jumptables for the conversion procedures, which are initalized to a local dummy function.

Then I do not generate include files, but a complete unit for every codepage we add. This unit will register itself to the ConverEncoding-unit in its initialisation part. So the user has full control over supported codepages of his application by simply using the the needed codepage-units.

Guy Fink

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Guy Fink

--- Urspr?ngliche Nachricht ---
Von: Marco van de Voort
An: , Lazarus mailing list
Betreff: Re: [Lazarus] rewriting of LConvEncoding

Show quoted text 16 lines
On Mon, Sep 20, 2010 at 11:16:39PM +0200, wrote: > > Note that FPC does contain a some conversion code in the RTL, > > see the ucmaps directory and the charset unit. > > The files in ucmaps are the files from ftp.unicode.org that I mentionned. > > My opinion is that static tables are smaller and faster than dynamic > mappings (especially for the asiancodepages), but memory could be an > issue. Perhaps this can be solved by smartlinking. Explain static/dynamic in this context. Note that there is a tool to change the conversions into tables, so they can be linked in, already.

With the tool you mean the charset-unit? What I see is, that charset is not finished. It just offers a rudimentary way to read in the unicode.org textfiles, and some functions to find a mapping and convert one character. No support for complete string conversions, or UTF-8, UTF-16, UTF-32.

The tables are created dynamically via getmem and stored in a linked list. Every character is stored in a record : tunicodecharmapping, where Unicode is only definded as word, not cardinal. Thus UTF32 is not supported, UTF16 surrogates neither. The list is lineary scanned to find a certain mapping, not really optimal for fast conversions. The backconversion unicode > character is even worse than the algortihm in LConvEncoding, it searches linear through the mapping, this may take some time on big asian codepages. (LConvEncoding uses a dual Quicksearch)

Charset has absolutly no support to handle endianess of UTF-16 and UTF-32 strings.

With static tables, I mean a table in a const-section, compiled and linked into the code. This offers optimization possibilities to the compiler regarding indexed access to the table content. The tables can be optimized for best fitting datasize, latincodepages can mostly be encoded as UCS2. Others, especially asiancodepages but also some MAC-codepages need UCS4. The backconversion can be optimized trough individual functions for every codepage.

It is easy to write an utility which creates the sourcecode for such this codepage-units.

Best regards

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Mattias Gaertner
to Guy Fink: --- Urspr?ngliche Nachricht --- Von: Felipe Monteiro de Carvalho An: , Lazarus mailing…
Show quoted text 35 lines
--- Urspr?ngliche Nachricht --- Von: Felipe Monteiro de Carvalho An: , Lazarus mailing list Betreff: Re: [Lazarus] rewriting of LConvEncoding > 2010/9/20 : > > I would rewrite the entire unit > > Great, just make sure you take all variables into account: > > * code size (check if your tables are smartlinkable. The current ones > are) > * speed > * maintenability > > On Mon, Sep 20, 2010 at 10:16 PM, Mattias Gaertner > wrote: > > And the tables are quite big. Maybe the unit should be splitted > into > > several units. > > In my tests the asian tables are smartlinked and won't be added unless > necessary. > > Splitting into several units is also possible, but then a registration > mechanism should be added. > > -- > Felipe Monteiro de Carvalho My first idea of the structure then: A ConvertEncoding-unit, containing all the necessary types,constants, function prototypes and the Unicodestuff. (conversions between the different UTF-variants). It could hold some jumptables for the conversion procedures, which are initalized to a local dummy function. Then I do not generate include files, but a complete unit for every codepage we add. This unit will register itself to the ConverEncoding-unit in its initialisation part. So the user has full control over supported codepages of his application by simply using the the needed codepage-units.

I think one unit per group is sufficient. For finer granularity there is smartlinking.

Mattias

Reply by email

Guy Fink
to Mattias Gaertner
Show quoted text 11 lines
> Then I do not generate include files, but a complete unit for every codepage we add. This unit will register itself to the ConverEncoding-unit in its initialisation part. So the user has full control over supported codepages of his application by simply using the the needed codepage-units. I think one unit per group is sufficient. For finer granularity there is smartlinking. Mattias

Ok, but than the registering of a mapping has to be made "by hand". Will say, if all the codepages in one unit are automatically registered during initialization, they compiler has to treat them as "used", even if the conversion functions are never really called. Or am I wrong?

What groups would make sense? As structured on ftp.unicode.org :

ISO8859 : codepages 1-15
Windows : cp12xx
IBM-PC : cp437 and so on
MAC : some of the MAC-mappings
EBCDIC : cp037, cp424, cp500, cp875, cp1026
MISC : ATARIST, NEXT, KOI8....

or grouped by characterspace :
Western europe (Latin)
Eastern europe (Kyrillic)
Eastasia, (or finer? Chinese, Japanese, Thai, Vietnamese......) Hebrew,
Greek
Special (like EBCDIC, ATARIST....)

Greetings

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Marco van de Voort
to Guy Fink: --- Urspr?ngliche Nachricht --- Von: Marco van de Voort An: , Lazarus mailing list…
Guy Fink wrote
> the conversions into tables, so they can be linked in, already. With the tool you mean the charset-unit?

No, I mean fpc/rtl/units/creumap.pp that afaik generates statically linkable units from ISO files that plugin to charset.

What I see is, that charset is not finished.

Then finish it.

It just offers a rudimentary way to read in the unicode.org textfiles, and some functions to find a mapping and convert one character. No support for complete string conversions, or UTF-8, UTF-16, UTF-32.

Then make a good proposal to fix this. Preferably with patches.

The tables are created dynamically via getmem and stored in a linked list. Every character is stored in a record : tunicodecharmapping, where Unicode is only definded as word, not cardinal. Thus UTF32 is not supported, UTF16 surrogates neither.

UTF32 is nowhere supported at all with FPC atm, and to be honest, I don't see a reason to start now. The unicode Delphi's also don't provide a type for it. It is simply the most practical format, and the few places where it is typically used , like complex string routines and the like, can survive on hardcode handoptimized code. (IOW it is not really an user type)

Since despite what people think, UTF32 is extremely wasteful, and still not free from problems (codepoints vs chars, denormalized sequences etc)

Show quoted text 5 lines
The list is lineary scanned to find a certain mapping, not really optimal for fast conversions. The backconversion unicode > character is even worse than the algortihm in LConvEncoding, it searches linear through the mapping, this may take some time on big asian codepages. (LConvEncoding uses a dual Quicksearch)

Well, one of the reasons is that the unit is mainly used for embedded applications (which includes DOS and win9x nowadays) or special cases (like very, very compatible installers), since on normal targets the OS routines are used.

Nevertheless, I don't want to hide behind that. Certainly, charset is pretty much a one-off effort and can be improved. But please, when reengineering, keep in mind that the "special" uses are the main ones.

But if everybody tries to roll something new instead of improving existing functionality the we are getting nowhere.

Charset has absolutly no support to handle endianess of UTF-16 and UTF-32 strings.

I would add separate special functions for that. No need to bog down the standard functions that do the bulk of the work. IOW a special functions that do input validation at the perimeter, and functions that only do internal conversions (e.g. that you could base the widestring manager on)

With static tables, I mean a table in a const-section, compiled and linked into the code.

Have a you had looked up where and how (c)charset is used, you would have noticed

(see e.g. compiler/cp*

Show quoted text 5 lines
This offers optimization possibilities to the compiler regarding indexed access to the table content. The tables can be optimized for best fitting datasize, latincodepages can mostly be encoded as UCS2. Others, especially asiancodepages but also some MAC-codepages need UCS4.

I don't see that last bit. Yes, some Asian codepages have some chars above the BMP, but afaik they are relatively rare. You might get more speed (due to better cache utilization) AND a better footprint by having a separate UCS2 table, and a separate check (and tables) for the surrogates.

It is easy to write an utility which creates the sourcecode for such this codepage-units.

See above.

Reply by email

Guy Fink
to Marco van de Voort
Show quoted text 7 lines
No, I mean fpc/rtl/units/creumap.pp that afaik generates statically linkable units from ISO files that plugin to charset. >What I see is, that charset is not finished. Then finish it.

Really, I don't know what to think of that order. I want to contribute to the project with my knowledge of more than 20 years programming in Pascal (since the very first days of Turpo Pascal). I surely will not waste my time on completing an algorhytm that I think is unappropriate for the problem!

Show quoted text 9 lines
> It just offers a rudimentary way to read in the unicode.org textfiles, and > some functions to find a mapping and convert one character. No support > for complete string conversions, or UTF-8, UTF-16, UTF-32. Then make a good proposal to fix this. Preferably with patches.

Does not really make sense when after applying the patch there is nothing left from the original.

Show quoted text 9 lines
> The tables are created dynamically via getmem and stored in a linked list. > Every character is stored in a record : tunicodecharmapping, where Unicode > is only definded as word, not cardinal. Thus UTF32 is not supported, > UTF16 surrogates neither. UTF32 is nowhere supported at all with FPC atm, and to be honest, I don't see a reason to start now. The unicode Delphi's also don't provide a type for it. It is simply the most practical format, and the few places

Is that really a reason not to start support for it? I don't think so. I even think it is a reason to support it, Delphi does not have full Unicodesupport, FPC will have.

Show quoted text 5 lines
where it is typically used , like complex string routines and the like, can survive on hardcode handoptimized code. (IOW it is not really an user type) Since despite what people think, UTF32 is extremely wasteful, and still not free from problems (codepoints vs chars, denormalized sequences etc)

UTF32 is there in the world, and yes it is wasteful.. And so what? Is that a reason to ignore it?

Well, one of the reasons is that the unit is mainly used for embedded applications (which includes DOS and win9x nowadays) or special cases (like very, very compatible installers), since on normal targets the OS routines are used.

These routines do not support all of the codepages. Further, the aim of a library is not to wrap some OS routines but to deliver functionality to the developer to help him solve his problem. Developers need solutions, not good words of how clean and ligthweigth the libraries are.

Show quoted text 7 lines
Nevertheless, I don't want to hide behind that. Certainly, charset is pretty much a one-off effort and can be improved. But please, when reengineering, keep in mind that the "special" uses are the main ones. But if everybody tries to roll something new instead of improving existing functionality the we are getting nowhere.

And if everybody holds on algorhytms which have been identified as beeing not appropriate to the problem you are getting nowhere either.

Show quoted text 19 lines
> Charset has absolutly no support to handle endianess of UTF-16 and UTF-32 > strings. I would add separate special functions for that. No need to bog down the standard functions that do the bulk of the work. IOW a special functions that do input validation at the perimeter, and functions that only do internal conversions (e.g. that you could base the widestring manager on) > With static tables, I mean a table in a const-section, compiled and linked > into the code. Have a you had looked up where and how (c)charset is used, you would have noticed (see e.g. compiler/cp*

I have noticed... and now? Doesn' t improve the algorhytm. Perhaps it is better first to think over the right datastructures than to write down some trivial lines of code and to propagate that these have to stay now like that till the end of the days.

Sorry at this point for these hard words. I really appreciate the work done by the FPC and Lazarus-Team. It is a great piece of work and I think it will have a great future. It is out of that thinking that I would like to contribute my small part to the project.

But M. van de Voort, I will not continue the discussion on this level and in this tone.

My first intention was to improve LConvEncoding. I still think this functionality has to be in the RTL, but I also said at the beginning of this threat that it is to the core-developers to decide if it can be integrated there. Mattias Gaertner approved to this, and even named a COMPLETE conversion unit in its post. Felipe Monteiro de Carvalho also agreed.

If now others think that this is not wanted, no problem for me, the unit may stay in the LCL, I can live with that very well.

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

waldo kitty
to Guy Fink
Guy Fink wrote 9 lines
> No, I mean fpc/rtl/units/creumap.pp that afaik generates statically > linkable units from ISO files that plugin to charset. > >> What I see is, that charset is not finished. > > Then finish it. Really, I don't know what to think of that order.

i don't see that as an "order"... more like "this is FOSS. you are free to fix things that you see and contribute them back to the community." ;)

I want to contribute to the project with my knowledge of more than 20 years programming in Pascal (since the very first days of Turpo Pascal).

ahhh... another oldtimer amongst us :P

I surely will not waste my time on completing an algorhytm that I think is unappropriate for the problem!

FWIW: *I* can understand that :)

Show quoted text 9 lines
>> It just offers a rudimentary way to read in the unicode.org >> textfiles, and some functions to find a mapping and convert >> one character. No support for complete string conversions, >> or UTF-8, UTF-16, UTF-32. > > Then make a good proposal to fix this. Preferably with patches. > Does not really make sense when after applying the patch there is nothing left from the original.

that would depend on the "fix" wouldn't it? it also depends on the core "guidance team" and if they accept the fix... remember one goal is to not break existing functionality... maybe your fix/enhancement would/should use different unit and include names so as to not break what's already being used in thousands of projects? that way the core team can bring it in gradually and/or existing projects can convert to it on their time and needs ;)

Show quoted text 12 lines
>> The tables are created dynamically via getmem and stored in a linked list. >> Every character is stored in a record : tunicodecharmapping, where Unicode >> is only definded as word, not cardinal. Thus UTF32 is not supported, >> UTF16 surrogates neither. > > UTF32 is nowhere supported at all with FPC atm, and to be honest, I don't > see a reason to start now. The unicode Delphi's also don't provide a type > for it. It is simply the most practical format, and the few places Is that really a reason not to start support for it? I don't think so. I even think it is a reason to support it, Delphi does not have full Unicodesupport, FPC will have.

one must also remember and take into account that delphi compatibility is a goal... that FPC and Laz have the option and ability to move further than delphi is a plus but delphi compatibility is still a requirement...

and what happens when delphi does add such capability? will your fix/enhancement be "updated" to match delphi?

Show quoted text 8 lines
> where it is typically used , like complex string routines and the like, can > survive on hardcode handoptimized code. (IOW it is not really an user type) > > Since despite what people think, UTF32 is extremely wasteful, and still > not free from problems (codepoints vs chars, denormalized sequences etc) UTF32 is there in the world, and yes it is wasteful.. And so what? Is that a reason to ignore it?

on the surface, i'd say "no" but another question that comes to mind is why invest time in it if it goes nowhere?

Show quoted text 9 lines
> Well, one of the reasons is that the unit is mainly used for embedded > applications (which includes DOS and win9x nowadays) or special cases > (like very, very compatible installers), since on normal targets the OS > routines are used. These routines do not support all of the codepages. Further, the aim of a library is not to wrap some OS routines but to deliver functionality to the developer to help him solve his problem. Developers need solutions, not good words of how clean and ligthweigth the libraries are.

i tend to agree with this, on the surface... however, much is actually done by providing wrappers so that existing functionality and compatibility can be maintained...

Show quoted text 10 lines
> Nevertheless, I don't want to hide behind that. Certainly, charset is > pretty much > a one-off effort and can be improved. But please, when reengineering, > keep in mind that the "special" uses are the main ones. > > But if everybody tries to roll something new instead of improving > existing functionality the we are getting nowhere. And if everybody holds on algorhytms which have been identified as beeing not appropriate to the problem you are getting nowhere either.

+1

Show quoted text 12 lines
>> Charset has absolutly no support to handle endianess of UTF-16 and UTF-32 >> strings. > > I would add separate special functions for that. No need to bog down the > standard functions that do the bulk of the work. IOW a special > functions > that do input validation at the perimeter, and functions that only do > internal conversions (e.g. that you could base the widestring manager > on) > >> With static tables, I mean a table in a const-section, compiled and >> linked into the code.

one must remember that FPC's and Laz's smartlinking stuff is nowhere near like that in TP/BP or delphi... but i'm also not sure if that fits with what you are saying, either...

Show quoted text 17 lines
> Have a you had looked up where and how (c)charset is > used, you would have noticed > > (see e.g. compiler/cp* I have noticed... and now? Doesn' t improve the algorhytm. Perhaps it is better first to think over the right datastructures than to write down some trivial lines of code and to propagate that these have to stay now like that till the end of the days. Sorry at this point for these hard words. I really appreciate the work done by the FPC and Lazarus-Team. It is a great piece of work and I think it will have a great future. It is out of that thinking that I would like to contribute my small part to the project. But M. van de Voort, I will not continue the discussion on this level and in this tone.

i'm not sure the perceived "tone" is what you seem to take it as...

Show quoted text 8 lines
My first intention was to improve LConvEncoding. I still think this functionality has to be in the RTL, but I also said at the beginning of this threat that it is to the core-developers to decide if it can be integrated there. Mattias Gaertner approved to this, and even named a COMPLETE conversion unit in its post. Felipe Monteiro de Carvalho also agreed. If now others think that this is not wanted, no problem for me, the unit may stay in the LCL, I can live with that very well.

since this is FOSS, i'd say to move forward keeping the above in mind and not hurting what is already out there... use what you can and write new stuff that may (eventually) replace it... that's the FOSS way from what i've seen over the years :)

Reply by email

Hans-Peter Diettrich
to Guy Fink: Really, I don't know what to think of that order. I want to contribute to the project…
Show quoted text 6 lines
> UTF32 is nowhere supported at all with FPC atm, and to be honest, I > don't see a reason to start now. The unicode Delphi's also don't > provide a type for it. It is simply the most practical format, and > the few places Is that really a reason not to start support for it?

What kind of support are you missing?

I don't think so. I even think it is a reason to support it, Delphi does not have full Unicodesupport, FPC will have.

What kind of applications will need such support?

IMO it's perfectly sufficient for 99.999% of all applications, when Unicode text can be stored and displayed.
For mere storage the encoding is irrelevant, or given by database data types.
For display purposes the OS specifies the encoding to use.

Further direct processing of such strings is limited to comparison, search, extraction and concatenation of substrings, what also is possible with every encoding, with no speed penalty. Transformations (upper, lower...) deserve according functions, that are provided by standard libraries, where again the libraries specify the supported encodings. Most such transformation applies *only* to the character based (alphabetic) codepages in the BMP, not to "word" based (Chinese, old Egypt...) codepages.

For all these purposes support of UTF-8 and -16 is perfectly sufficient.

The only place for 4 byte (UTF-32) characters might be an according char type, but the existence of ligatures and other constructs strongly suggest to use strings for storing even single character codes. For the same reason it's *not* wise to iterate through strings by index, instead iterator functions for the next/preceding character index have to be used. Pascal sets of such an char type are impractical, wasting 128MB of memory for *every single* set variable or constant. Does anybody know of an alphabetic codepage with more than 256 character codes?

UTF32 is there in the world, and yes it is wasteful.. And so what? Is that a reason to ignore it?

Please give only a *single* reasonable application, where UTF-32 would result in an improvement over the existing string types and encodings. I cannot remember any single user, who was *really* familiar with full Unicode text manipulation and all related complications, and who wanted to have a native UTF-32 encoding for strings.

Show quoted text 8 lines
> Well, one of the reasons is that the unit is mainly used for > embedded applications (which includes DOS and win9x nowadays) or > special cases (like very, very compatible installers), since on > normal targets the OS routines are used. These routines do not support all of the codepages. Further, the aim of a library is not to wrap some OS routines but to deliver functionality to the developer to help him solve his problem.

The implementation and *continued* support of such additional libraries should be up to companies or (at least) appropriately skilled user groups, familiar with all implemented codepages. Everybody can start such projects, independently from any programming language and compiler. And there is no need that such libraries *must* become part of the core libraries, or that they *must* replace existing libraries. They can be implemented and used as additional libraries as well, and the *users* will judge about their value.

DoDi

Reply by email

Graeme Geldenhuys
to waldo kitty: i don't see that as an "order"... more like "this is FOSS. you are free to fix things…
waldo kitty wrote
one must also remember and take into account that delphi compatibility is a goal... that FPC and Laz have the option and ability to move further than delphi is a plus but delphi compatibility is still a requirement...

And the downfall of Lazarus LCL.

and what happens when delphi does add such capability? will your fix/enhancement be "updated" to match delphi?

And this is where the "being delphi compatible" pipe dream falls flat on it's face! First we get bitched at for not contributing, then we do, then delphi implements it in a totally different way (sometimes years down the line - and sometimes I think on purpose in a different way), then it is expected from us to break backward compatibility with FPC itself, and rewrite features to be yet again delphi compatible. No innovation - simply follow Delphi like lambs to the slaughterhouse. That is NO WAY to run a FOSS project.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

Leonardo M. Ramé
to Graeme Geldenhuys
Graeme Geldenhuys wrote 24 lines
On 24 September 2010 00:41, waldo kitty wrote: > one must also remember and take into account that delphi compatibility is a > goal... that FPC and Laz have the option and ability to move further than > delphi is a plus but delphi compatibility is still a requirement... And the downfall of Lazarus LCL. > and what happens when delphi does add such capability? will your > fix/enhancement be "updated" to match delphi? And this is where the "being delphi compatible" pipe dream falls flat on it's face! First we get bitched at for not contributing, then we do, then delphi implements it in a totally different way (sometimes years down the line - and sometimes I think on purpose in a different way), then it is expected from us to break backward compatibility with FPC itself, and rewrite features to be yet again delphi compatible. No innovation - simply follow Delphi like lambs to the slaughterhouse. That is NO WAY to run a FOSS project. -- Regards, ? - Graeme -

I agree 100% with Graeme. FPC and Lazarus should follow its own path.

Leonardo M. Ram? Medical IT - Griensu S.A. Av. Col?n 636 - Piso 8 Of. A X5000EPT -- C?rdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 Cel.: +54(351)5394365

Reply by email

Guy Fink
Show quoted text 14 lines
I'm not going into detail about your rant, I don't have time for ego management, I'll just summarize my remarks again, slightly trying to explain them when necessary: - first, try to reuse as much as possible. Specially the interfaces of charset. Since otherwise this becomes the 4th or 5th charset conversion unit, and yet another maintenance burden. Lconv or charset, doesn't matter. - charset - ccharset ( a copy of ccharset cut down for compiler use) - iconvenc - lconvencoding - your solution

Ok, I fully agree. Since I started from LConvEncoding I planned to kee at least the existing interface, so no completly new solution anyway (from the side of the interface), I see no problem to integrate the existing charset interface. Internally it will be completely different, especially faster and smaller (I hope :-))

Show quoted text 8 lines
- Keep in mind that in practice such units are used mostly by embedded targets. And maybe a few people that have special codepage needs will use it in addition. Size (code+ tables) is of importance here. Users must be able to only add a few codepages. - Keep the minimal dependancies as low as possible, allowing it to be positioned as deep as possible in the FPC/Lazarus system. This means both libraries as footprint. Make tables pluggable.

Thats what I have in mind. The only dependencies I have is the UTF8 and UTF16 functions from LProc. But as I understood it is also forseen to integrate these routines in the RTL. I think this would be the time to do that also and create a proper and complete character-conversion library.

- I've never seen UTF32 files in the wild. I assume however that smartlinking will adequately kill those routines, so it is not that much of a problem unless you use it internally.

If there is support fot UTF16, UTF32 does not really blow up the code. 2 lines of code to decode surrogate pairs, thats it.

Show quoted text 17 lines
We all want to get rid of lconvencoding, or at least break it up in to pieces and move it from the LCL to the RTL. That's why starting with 2.2.4 I added an iconvenc unit to pull the iconv support out of for the lconvencoding. Having a table driven package would pull even more out of it (I guess lconvencoding will persist for a while to allow the lazarus team to deal with FPC versioning, but it will be mostly empty), so I'm all for it. But be a bit flexible and keep an eye on the usage scenarios. Note that units that are very large can't be in the RTL. (the RTL is compiled three-five times each bootstrap) If large then it must go to packages/

I know that. The core-unit witchsupports UTF8, UTF16 and UTF32 does not need tables, so size is no matter there.

Support for codepages will be in separate units which will plugin to the core-unit. I still prefer a one unit per codepage solution, this will give the most flexibility and will not stress smartlinking to much.

Greetings

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Guy Fink
to waldo kitty: i don't see that as an "order"... more like "this is FOSS. you are free to fix things…
Show quoted text 6 lines
> I want to contribute to the project with my knowledge of more than 20 > years programming in Pascal (since the very first days of Turpo Pascal). ahhh... another oldtimer amongst us :P

:P yes, the good ald times, Turbo Pascal on 1 floppy, and the sources on the 2nd :-) and there was this 64KB limit (yes 64, not 640) *g*

Show quoted text 11 lines
that would depend on the "fix" wouldn't it? it also depends on the core "guidance team" and if they accept the fix... remember one goal is to not break existing functionality... maybe your fix/enhancement would/should use different unit and include names so as to not break what's already being used in thousands of projects? that way the core team can bring it in gradually and/or existing projects can convert to it on their time and needs ;)

Thats what I have in mind. It is clear that existing projects should continue to work...

Show quoted text 12 lines
> Is that really a reason not to start support for it? I don't think so. I even > think it is a reason to support it, Delphi does not have full Unicodesupport, > FPC will have. one must also remember and take into account that delphi compatibility is a goal... that FPC and Laz have the option and ability to move further than delphi is a plus but delphi compatibility is still a requirement... and what happens when delphi does add such capability? will your fix/enhancement be "updated" to match delphi?

Why not? But as long as Delphi does not have the capabilties, why should we restrict ourselve?

Show quoted text 6 lines
> UTF32 is there in the world, and yes it is wasteful.. And so what? Is that a > reason to ignore it? on the surface, i'd say "no" but another question that comes to mind is why invest time in it if it goes nowhere?

If you support UTF16, UTF32 is really not a great investment, neither in time nor in resources.

Show quoted text 9 lines
> These routines do not support all of the codepages. Further, the aim of a > library is not to wrap some OS routines but to deliver functionality to the > developer to help him solve his problem. Developers need solutions, not good > words of how clean and ligthweigth the libraries are. i tend to agree with this, on the surface... however, much is actually done by providing wrappers so that existing functionality and compatibility can be maintained...

Adding functinalty does not mean that existings things have to been throwne away.

Show quoted text 7 lines
>>> With static tables, I mean a table in a const-section, compiled and >>> linked into the code. one must remember that FPC's and Laz's smartlinking stuff is nowhere near like that in TP/BP or delphi... but i'm also not sure if that fits with what you are saying, either...

Ok, but you agree that it is easier for the compiler to optmize access to an array of WORD or DWORD, with a known size at compile time, than to a linked list of dynamic arrays of some record type?

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu

Reply by email

Guy Fink
to Unknown author: An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/laz…

Hello all

So I have a first unit up and running. It is not yet finished and not yet bugfree, but it compiles and I have tested the UTF8 part.

This first tests for ISO-8859-1 and ISO-8859-2 showed a performance gain up to 33% compared to LConvEncoding. It should be much more for Doublebyte codepages.

The main work lies not in LConvEncodingNew (just the working name for now) but in ConverCPFile (in subdir Codepages). ConvertCPFile is an application to read a Codepage to Unicode descrition file (formated as those found on unicode.org) and generate an optimized pascal unit which can be compiled and linked in. There are some possibilities to influence the code generated.

My aim for this prerelease is to get echos and suggestions concerning the direcory structure and the naming conventions. Also comments and suggetions for the choosen strategy are welcome.

Greetings

______________________________________________________ powered by GLOBER.LU
Luxembourg Internet Service Provider
Hosting. Domain Registration, Webshops, Webdesign, FreeMail ...

Our professional Web Hosting plans include all the features you are looking for at the best possible price. www.globe.lu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LConvEncodingNew.zip
Type: application/zip
Size: 66179 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101016/9cc02cac/attachment-0001.zip>

Reply by email