Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gprbuild and working with variables and source files in UTF-8 #118

Open
krouziciorel opened this issue Sep 7, 2022 · 0 comments
Open

Gprbuild and working with variables and source files in UTF-8 #118

krouziciorel opened this issue Sep 7, 2022 · 0 comments

Comments

@krouziciorel
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant