Commit 5052d823 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

On failure, don't fall back to the locale encoding anymore but straight to

* src/stringutils.cc (filename_to_utf8_fallback): On failure,
don't fall back to the locale encoding anymore but straight to
plain ASCII.  Thus from now on, this function will never throw
for errors of type ConvertError::ILLEGAL_SEQUENCE.  Also cover
the new G_FILENAME_ENCODING variable in the warning message.

* src/filetree.cc (FileTree::find_files): Remove the explicit
handling of Glib::ConvertError.
parent 0bbdc74b
2004-05-27 Daniel Elstner <daniel.elstner@gmx.net>
* src/stringutils.cc (filename_to_utf8_fallback): On failure,
don't fall back to the locale encoding anymore but straight to
plain ASCII. Thus from now on, this function will never throw
for errors of type ConvertError::ILLEGAL_SEQUENCE. Also cover
the new G_FILENAME_ENCODING variable in the warning message.
* src/filetree.cc (FileTree::find_files): Remove the explicit
handling of Glib::ConvertError.
2004-05-26 Daniel Elstner <daniel.elstner@gmx.net>
* regexxer.schemas.in: Use colors from the basic GNOME 32-color
......
......@@ -395,16 +395,6 @@ void FileTree::find_recursively(const std::string& dirname, FindData& find_data)
// Collect errors but don't interrupt the search.
find_data.error_list->push_back(error.what());
}
catch (const Glib::ConvertError& error) // unlikely due to use of our own fallback conversion
{
// Don't use Glib::locale_to_utf8() because we already
// tried that in Util::filename_to_utf8_fallback().
//
const Glib::ustring name = Util::convert_to_ascii(fullname);
const Glib::ustring what = error.what();
g_warning("Eeeek, can't convert filename `%s' to UTF-8: %s", name.c_str(), what.c_str());
}
}
find_increment_file_count(find_data, file_count);
......
......@@ -601,12 +601,12 @@ Glib::ustring Util::filename_to_utf8_fallback(const std::string& filename)
throw;
}
const Glib::ustring filename_utf8 = Glib::locale_to_utf8(filename);
const Glib::ustring filename_utf8 = Util::convert_to_ascii(filename);
g_warning("The filename encoding of `%s' is not UTF-8 but G_BROKEN_FILENAMES is unset. "
"Falling back to locale encoding for backward compatibility, but you should "
"either set the environment variable G_BROKEN_FILENAMES=1 or convert all your "
"filenames to UTF-8 encoding, as it should be.", filename_utf8.c_str());
g_warning("The filename `%s' is not valid UTF-8. To work around that, please "
"set G_FILENAME_ENCODING to the local encoding used for filenames. "
"Alternatively, convert all your legacy filenames to UTF-8 encoding.",
filename_utf8.c_str());
return filename_utf8;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment