With modern languages (Python, Java, Rust) it is not a problem to use UTF-8 characters in variable names and files. I assumed that the Ada language does not offer this possibility, but I found a very nicely written article by Maxim Reznik, who solved the same problem with Russian alphabet characters:
begin
Ada.Wide_Text_IO.Put_Line (Привет);
Ada.Wide_Text_IO.Put_Line (Kroužící_opeřenec);
end Kroužící_orel;
I can compile it using the command:
gnatmake -gnatWu kroužící_orel.adb
or
gnatmake -gnatWu -gnatiw kroužící_orel.adb
However, if I create a GPR project with the following directory structure:
/obj
/src - kroužící_orel.adb
kroužící_orel.gpr
where the file kroužící_orel.gpr contains:
project Kroužící_orel is
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Main use ("kroužící_orel.adb");
package Compiler is
for Switches ("ada") use ("-gnatWu");
for Switches ("ada") use ("-gnatiw");
end Compiler;
end Kroužící_orel;
I get an error messages:
gprbuild kroužící_orel.gpr
kroužící_orel.gpr" is not a valid path name for a project file
kroužící_orel.gpr:1:14: illegal character
kroužící_orel.gpr:1:16: illegal character
kroužící_orel.gpr:1:19: illegal character
kroužící_orel.gpr:1:20: unknown variable "_Orel"
kroužící_orel.gpr:12:10: illegal character
kroužící_orel.gpr:12:11: expected "krouUe5"
gprbuild: "kroužící_orel.gpr" processing failed
If I rename the files kroužící_orel.adb and kroužící_orel.gpr to krouzici_orel.adb and krouzici_orel.gpr (here I change the directives Project, for Main use and end to Krouzici_orel), the translation with gprbuild is OK.
All in all, the only problem gprbuild has is when trying to translate source files in UTF-8 encoding.
With modern languages (Python, Java, Rust) it is not a problem to use UTF-8 characters in variable names and files. I assumed that the Ada language does not offer this possibility, but I found a very nicely written article by Maxim Reznik, who solved the same problem with Russian alphabet characters:
https://www.ada-ru.org/utf-8
For example, if I have a source file named:
kroužící_orel.adb
and content (where I test both Russian and Czech alphabet characters):
with Ada.Wide_Text_IO;
procedure Kroužící_orel is Привет : constant Wide_String := "Привет"; Kroužící_opeřenec : constant Wide_String := "Kroužící opeřenec";
begin Ada.Wide_Text_IO.Put_Line (Привет); Ada.Wide_Text_IO.Put_Line (Kroužící_opeřenec); end Kroužící_orel;
I can compile it using the command:
gnatmake -gnatWu kroužící_orel.adb
or
gnatmake -gnatWu -gnatiw kroužící_orel.adb
However, if I create a GPR project with the following directory structure:
/obj /src - kroužící_orel.adb kroužící_orel.gpr
where the file kroužící_orel.gpr contains:
project Kroužící_orel is for Source_Dirs use ("src"); for Object_Dir use "obj"; for Main use ("kroužící_orel.adb"); package Compiler is for Switches ("ada") use ("-gnatWu"); for Switches ("ada") use ("-gnatiw"); end Compiler; end Kroužící_orel;
I get an error messages:
gprbuild kroužící_orel.gpr
kroužící_orel.gpr" is not a valid path name for a project file kroužící_orel.gpr:1:14: illegal character kroužící_orel.gpr:1:16: illegal character kroužící_orel.gpr:1:19: illegal character kroužící_orel.gpr:1:20: unknown variable "_Orel" kroužící_orel.gpr:12:10: illegal character kroužící_orel.gpr:12:11: expected "krouUe5"
gprbuild: "kroužící_orel.gpr" processing failed
If I rename the files kroužící_orel.adb and kroužící_orel.gpr to krouzici_orel.adb and krouzici_orel.gpr (here I change the directives Project, for Main use and end to Krouzici_orel), the translation with gprbuild is OK.
All in all, the only problem gprbuild has is when trying to translate source files in UTF-8 encoding.