[fpc-pascal] UTF-8 versions of Copy() and Length()

Daniël Mantione daniel.mantione at freepascal.org
Sat May 19 11:42:43 CEST 2007



Op Sat, 19 May 2007, schreef Graeme Geldenhuys:

> On 5/19/07, Daniël Mantione <daniel.mantione at freepascal.org> wrote:
> > 
> > I think a utf8 unit would be usefull.
> 
> Glad you agree.  I searched through the mailing list and found quite a
> few people that required such function and implemented their own.  So
> yes, why don't we include a new unit with those functions for
> everybody to use. The Lazarus project (LCLProc unit) has been tried
> and tested for ages.  We can create a new unit based on the functions
> in there - just remove any LCL specific functions.
> 
> Seeing that the LCLProc unit has been in use for ages in Lazarus, any
> chance that we can get such a unit fast-tracked and included in trunk
> and fixes_2_2 branch?  Ready for the next release.

As far as I am concerned, it can only go in fixes_2_2 after it has proven 
to be stable and should not disrupt the 2.2 release. In other words, it 
might not make 2.2.0, but could make 2.2.2.

> It shouldn't interfere with any existing applications, because it will
> be a new and separate unit. It's also been well tested in Lazarus.
> 
> So what name could we give such a unit.  unicodeutils.pas?  utfutils.pas?
> 
> > > The Length function is easy to get around, but the Copy, Pos ,etc
> > > functions are not.
> > 
> > Why?
> 
> I meant not easy by inline'ing things like your Length example.  The
> UTF8Copy() function requires a bit more coding, that's all.

It is mostly usefull if you use widestrings internally. If you use utf-8 
internally I agree an utf-8 would be more comfortable.

Daniël


More information about the fpc-pascal mailing list