Hi,
In GParted we’ve got code like this:
try {
Glib::spawn_async_with_pipes(...);
} catch (Glib::SpawnError &e) {
std::cerr << e.what() << std::endl;
}
When the exception is caught it prints the error like this and GParted carries on. Note the unicode quotation marks around the missing btrfs program name:
# gparted
...
Failed to execute child process “btrfs” (No such file or directory)
However when the user runs GParted in the C locale it hangs forever like this:
# LANG=C gparted
...
(gpartedbin-1.6.0-master-53-ged5623ff:1461271): glibmm-CRITICAL **: 08:54:42.030:
unhandled exception (type Glib::Error) in signal handler:
domain: g_convert_error
code : 1
what : Invalid byte sequence in conversion input
I understand that I can change the error printing line to this to just bypass ustring’s character set conversion and print the UTF-8 characters to stderr regardless:
std::cerr << std::string(e.what()) << std::endl;
-
However is there a proper way to convert and print this glibmm(glib) exception containing UTF-8 characters in the C locale?
-
Is there a reason glib needs to use unicode quote marks in gspawn-posix.c, or should it use plain ascii quote marks so the message is valid in the C locale (all locales) without conversion?
Thanks,
Mike