Use locale names with better linux/osx/win cross-platform compatibility (old did not work on OSX); use less specific exception objects to avoid strange throw issues on OSX builds
This commit is contained in:
parent
81f5e72b82
commit
b6c57cd298
@ -259,15 +259,15 @@ Glib::ustring safe_filename_to_utf8 (const std::string& src)
|
||||
try {
|
||||
utf8_str = Glib::locale_to_utf8(src);
|
||||
}
|
||||
catch (const Glib::ConvertError& e) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF8", "LATIN1","?");
|
||||
catch (const Glib::Error& e) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1","?");
|
||||
}
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
utf8_str = locale_to_utf8(src, error);
|
||||
if (error.get())
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF8", "LATIN1","?", error);
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1","?", error);
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
#else
|
||||
@ -283,15 +283,15 @@ Glib::ustring safe_locale_to_utf8 (const std::string& src)
|
||||
try {
|
||||
utf8_str = Glib::locale_to_utf8(src);
|
||||
}
|
||||
catch (const Glib::ConvertError& e) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF8", "LATIN1","?");
|
||||
catch (const Glib::Error& e) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1","?");
|
||||
}
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
utf8_str = locale_to_utf8(src, error);
|
||||
if (error.get())
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF8", "LATIN1","?", error);
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1","?", error);
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
return utf8_str;
|
||||
@ -304,15 +304,15 @@ std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str)
|
||||
try {
|
||||
str = Glib::locale_from_utf8(utf8_str);
|
||||
}
|
||||
catch (const Glib::ConvertError& e) {
|
||||
//str = Glib::convert_with_fallback(utf8_str, "LATIN1", "UTF8", "?");
|
||||
catch (const Glib::Error& e) {
|
||||
//str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?");
|
||||
}
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
str = Glib::locale_from_utf8(utf8_str, error);
|
||||
/*if (error.get())
|
||||
{str = Glib::convert_with_fallback(utf8_str, "LATIN1", "UTF8", "?", error);}*/
|
||||
{str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?", error);}*/
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
return str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user