[fpc-devel] Unicode resource strings

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Aug 21 11:24:38 CEST 2012

On 21 August 2012 10:01, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
>> > The conversion is done only when entering and exiting the OS / GUI framework
>> > calls. I understand this does not happen too often.
>> I beg to differ.
> Maybe you can name some example.

OK, lets assume I'm under Linux and fpGUI uses UTF-8 internally
(ideally I would like fpGUI to use the correct encoding on each

TfpgMemo,LoadFromFile().   TfpgMemo uses a TStringList internally,
which LoadFromFile maps too. Under Linux, filenames are UTF-8 encoded,
so conversion occurs because TStringList uses UTF-16 (as per the FPC
2.7.1 suggestions) for the filename variable, and for all the file
access routines. The file contains UTF-8 encoded text. They are now
converted to UTF-16 text to be stored internally in the TStringList.
fpGUI now needs to display that text, so calls the UTF-8 X11 API's, so
another conversion is required.

This is a simple example, but look at all the conversions already. Now
if UnicodeString uses the correct encoding on each platform, the
conversions would be zero!

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-devel mailing list