[fpc-devel] Unicode weirdness

Adriaan van Os adriaan at adriaan.biz
Fri Feb 27 11:04:56 CET 2026


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




More information about the fpc-devel mailing list