Sign in Join

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

Mailing lists / fpc-devel / 2008-11

UnicodeString and RTL

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

Is there any list of missing features for UnicodeString in the RTL?

For example:

* I can't seem to find a UnicodeString version of TStrings or TStringList

Any more such cases? I would like to create a RTL UnicodeString RoadMap, so the missing parts can be know and implemented.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Florian Klaempfl
to Graeme Geldenhuys
Show quoted text 10 lines
Hi, Is there any list of missing features for UnicodeString in the RTL? For example: * I can't seem to find a UnicodeString version of TStrings or TStringList Any more such cases?

No idea, nobody complainted so far ;) Just create one.

I would like to create a RTL UnicodeString RoadMap, so the missing parts can be know and implemented.

Reply by email

Aleksa Todorovic
to Florian Klaempfl: No idea, nobody complainted so far ;) Just create one.

Or... it could be implemented using generics, so one can choose:

TStringList<UnicodeString>
TStringList<AnsiString>
TStringList<ShortString>

(sorry for C++ish syntax, but I hope you understand)

Florian Klaempfl wrote 21 lines
Graeme Geldenhuys schrieb: > Hi, > > Is there any list of missing features for UnicodeString in the RTL? > > For example: > > * I can't seem to find a UnicodeString version of TStrings or TStringList > > > Any more such cases? No idea, nobody complainted so far ;) Just create one. > I would like to create a RTL UnicodeString > RoadMap, so the missing parts can be know and implemented. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Graeme Geldenhuys
to Michael Schnell: As long as the ANSIString and UTF8String and String types are the same to the compiler…
Michael Schnell wrote 6 lines
> * I can't seem to find a UnicodeString version of TStrings or TStringList > As long as the ANSIString and UTF8String and String types are the same to the compiler this questions does not make too much sense.

Well those all refer to ANSI string types. I was referring to WideString and UnicodeString types - as is available in FPC 2.3.1

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Aleksa Todorovic: Or... it could be implemented using generics, so one can choose:…
Aleksa Todorovic wrote 7 lines
Or... it could be implemented using generics, so one can choose: TStringList<UnicodeString> TStringList<AnsiString> TStringList<ShortString> (sorry for C++ish syntax, but I hope you understand)

I somehow managed to skip the whole generics thing and have no clue how they work, but I will give it a once over before I start the TStrings and TStringList implementations. Maybe I can hit two birds with one stone. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Florian Klaempfl
to Graeme Geldenhuys
Show quoted text 14 lines
On Thu, Nov 20, 2008 at 4:10 PM, Aleksa Todorovic wrote: > Or... it could be implemented using generics, so one can choose: > > TStringList<UnicodeString> > TStringList<AnsiString> > TStringList<ShortString> > > (sorry for C++ish syntax, but I hope you understand) I somehow managed to skip the whole generics thing and have no clue how they work, but I will give it a once over before I start the TStrings and TStringList implementations. Maybe I can hit two birds with one stone. :-)

See http://svn.freepascal.org/svn/fpc/trunk/rtl/objpas/fgl.pp

The trick is to have an type independend core class and a type aware wrapper. This keeps the executable size low even with a lot of specializations.

Reply by email

Michael Schnell
to Graeme Geldenhuys: Well those all refer to ANSI string types. I was referring to WideString and…
Show quoted text 5 lines
> As long as the ANSIString and UTF8String and String types are the same to > the compiler this questions does not make too much sense. > Well those all refer to ANSI string types.

What do you mean by this ? These refer to "Byte String Types"

I was referring to WideString and UnicodeString types - as is available in FPC 2.3.1

UTF8 _is_ a Unicode coding and thus UTF8String _should_be_ a Unicode String type (of course it is not in the current implementation, as the compiler can't tell it from ANSIString, but that is exactly what we are discussing right now.) If UTF8String is not a Unicode type there is no right for it to exist.

-Michael

Reply by email

Graeme Geldenhuys
to Michael Schnell
Michael Schnell wrote 6 lines
UTF8 _is_ a Unicode coding and thus UTF8String _should_be_ a Unicode String type (of course it is not in the current implementation, as the compiler can't tell it from ANSIString, but that is exactly what we are discussing right now.) If UTF8String is not a Unicode type there is no right for it to exist.

Well at the moment, UnicodeString (the type in FPC 2.3.1) is a UTF-16 type, not a UTF-8 type. So while FPC doesn't have a native UTF8 type, I'll start implementing the UTF-16 version using UnicodeString type.

UTF8String is not an actual type, but rather just an alias to String type or AnsiString type. Like you said, the compiler doesn't distinguishes between those.

I'm not arguing, I'm simply interested in getting the ball rolling with improved Unicode support. Even if that means only having UTF-16 support at the moment. And with my current FPC knowledge that limits me to the RTL only, I don't have the knowledge to implement native UTF-8 types in FPC - that's a job for Florian or somebody else with better knowledge of compiler internals.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Michael Schnell
Michael Schnell wrote 6 lines
> UnicodeString (the type in FPC 2.3.1) is a UTF-16 > type, > I was not aware that there is a type with this name. Why does it exist ? WideString that is not Unicode does not make much sense.

I'm new to this, but as far as I understand, WideString is for backward compatibility on Windows olestr type. It's not reference counted. Whereas UnicodeString type is reference counted on all platforms.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Schnell
to Graeme Geldenhuys
Show quoted text 5 lines
I'm new to this, but as far as I understand, WideString is for backward compatibility on Windows olestr type. It's not reference counted. Whereas UnicodeString type is reference counted on all platforms.

I found the paragraph in the Wiki :) .

I wonder how we should deal with not reference counting strings. I suppose it's a similar mess as with dynamic arrays: to free you need to do a setlength to 0 or similar.

-Michael

Reply by email