Sign in Join

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

Mailing lists / fpc-devel / 2026-02

Unicode weirdness

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Adriaan van Os

Consider the following test program

program testunicode;
uses
   SysUtils;
var
   f: file;
   b: boolean;
begin
   Assign( f, 'tést');
   Rewrite( f);
   Close( f);
   b := FileExists( 'tést');
   writeln( 'file exists test result: ', b)
end.

This is on macOS in UTF-8. The special character in tést should display as an accented lowercase E.

Now, if I compile with -MUnicode with either fpc-3.0.4 or 3.2.4-rc1 or 3.3.1-trunk, I get this (on macOS 14)

[Mac-mini:~/fpc-test/unicode] administrator% /usr/local/lib/fpc/3.2.4/ppca64 -gl -MDelphiUnicode testunicode.pas
Free Pascal Compiler version 3.2.4-rc1 [2025/10/15] for aarch64 Copyright (c) 1993-2024 by Florian Klaempfl and others Target OS: Darwin for AArch64
Compiling testunicode.pas
Assembling testunicode
Linking testunicode
ld: warning: -multiply_defined is obsolete
-macosx_version_min has been renamed to -macos_version_min 18 lines compiled, 0.1 sec

[Mac-mini:~/fpc-test/unicode] administrator% ./testunicode An unhandled exception occurred at $00000001005D7B28: EInOutError: Unknown Run-Time error : 092
$00000001005D7B28

The crash disappears if I use another compiler mode than -MDelphiUnicode. It also disappears when replacing the accented lowercase E by a plain lowercase E.

Any comments ?

The FileExists call isn't needed to reproduce, but the test was originally written to test FPC Unicode normalization (?} on macOS in filenames with fpc-3.3.1.

Regards,

Adriaan van Os

Reply by email

Adriaan van Os
to Sven Barth
Sven Barth wrote 10 lines
Adriaan van Os via fpc-devel < > schrieb am Fr., 27. Feb. 2026, 11:05: Any comments ? Does the behavior change if you add a use of unit cwstrings before the SysUtils unit?

Well, when I add cwstring before the SysUtils unit in the USES clause, then

* it now crashes with fpc-3.3.1-trunk, with or without -MDelphiUnicode
* it no longer crashes with fpc-3.0.4 and fpc-3.2.4-rc1, with or without -MDelphiUnicode

Regards,

Adriaan van Os

Reply by email