[fpc-pascal] FPC Unicode / CodePage aware strings

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Dec 10 12:01:49 CET 2015


On 2015-12-10 10:35, Graeme Geldenhuys wrote:
> Now I try and run the binary and get the following error.
> 
> [t2]$ ./project1
> This binary has no unicodestrings support compiled in.
> Recompile the application with a unicodestrings-manager in the program
> uses clause.
> An unhandled exception occurred at $000000000044354D:
> ENoWideStringSupport: SIGQUIT signal received.
>   $000000000044354D
> 
> 
> Okay, so I add the "unicodestrings-manager" unit to the program unit's
> uses clause, as the above message suggests.
> 
> Now I can't compile the project...


Okay, I changed my program to a console program. After much searching I
found that "unicodestrings-manager" is not actually a unit. I tried
"cwstrings" instead - the wiki page didn't mention this - and could
compile and run my program.

[t2]$ ./project1
WideChar
UpCase ù: Ù
ToUpper ù: Ù
AnsiChar
UpCase ù: ?
ToUpper ù: ?



The output is not the same as the output from the
"Delphi_and_Unicode.pdf" example.


Source code:
The .pas unit is stored as a UTF-8 encoded file, and the program was run
in mate-terminal and xterm, showing the same output as above.

===========================
program project1;

{$mode delphiunicode}{$H+}

uses
  cwstring,
  Classes, SysUtils, Character;



var
  ch1: Char;
  ch2: AnsiChar;
begin
  ch1 := 'ù';
  Writeln('WideChar');
  Writeln('UpCase ù: ' + UpCase(ch1));
  Writeln('ToUpper ù: ' + ToUpper (ch1));
  ch2 := 'ù';
  Writeln('AnsiChar');
  Writeln('UpCase ù: ' + UpCase(ch2));
  Writeln('ToUpper ù: ' +  ToUpper(ch2));
end.
===========================


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list