Commit 59efcbe4 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

Replace non-ASCII characters by octal escapes rather than just a question

* src/stringutils.cc (convert_to_ascii): Replace non-ASCII
characters by octal escapes rather than just a question mark.
parent dacb56ec
2004-05-28 Daniel Elstner <daniel.elstner@gmx.net>
* src/stringutils.cc (convert_to_ascii): Replace non-ASCII
characters by octal escapes rather than just a question mark.
2004-05-28 Daniel Elstner <daniel.elstner@gmx.net>
* src/filebuffer.cc (RegexxerTags::instance): Remove G_GNUC_CONST
......
......@@ -613,18 +613,23 @@ Glib::ustring Util::filename_to_utf8_fallback(const std::string& filename)
Glib::ustring Util::convert_to_ascii(const std::string& str)
{
std::string result = str;
std::ostringstream output;
#if REGEXXER_HAVE_STD_LOCALE
output.imbue(std::locale::classic());
#endif
std::string::iterator p = result.begin();
std::string::iterator pend = result.end();
output.setf(std::ios::oct, std::ios::basefield);
for (; p != pend; ++p)
for (std::string::const_iterator p = str.begin(); p != str.end(); ++p)
{
if ((*p & '\x80') != 0)
*p = '?';
if ((*p & '\x80') == 0)
output << *p;
else
output << '\\' << static_cast<unsigned int>(static_cast<unsigned char>(*p));
}
return result;
return output.str();
}
Glib::ustring Util::int_to_string(int number)
......
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