[Vala] printf bug with nonlatin pattern




printf don't accept  nonlatin  string as pattern:

for example:
stdout.printf("Успешно %s", "прошел");

or

"Успешно %s".printf("прошел");

but sucessfully accept predefined string!

for example:

string pattern = "Успешно %s";
pattern.printf("прошел");


testcase attached;

valac -o string_bug  string_bug.vala

string_bug.vala:11.5-11.41: error: Too many arguments for specified format
   stdout.printf("Успешно %s", "прошел");
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)


But with workaround:

valac -o string_bug  string_bug.vala

./string_bug
Успешно прошел

//valac -o string_bug  string_bug.vala

public class StringBug : GLib.Object 
 {

    public static int main (string[] args) {


// this is case to reproduce bug in valac
//    stdout.printf("Успешно %s", "прошел");

// this is workaround 
    string pattern = "Успешно %s";
    stdout.printf(pattern,"прошел");

    return 0;
  }

}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]