Logo Search packages:      
Sourcecode: ardour version File versions  Download package

Glib::ustring Glib::locale_to_utf8 ( const std::string &  opsys_string  ) 

Convert from the current locale's encoding to UTF-8. Convenience wrapper around Glib::convert().

Parameters:
opsys_string The string to convert. Must be encoded in the charset used by the operating system's current locale.
Returns:
The input string converted to UTF-8 encoding.
Exceptions:
Glib::ConvertError 

Definition at line 171 of file convert.cc.

Referenced by Glib::Date::format_string(), and Glib::ustring::operator>>().

{
  gsize bytes_written = 0;
  GError* error = 0;

  char *const buf = g_locale_to_utf8(
      opsys_string.data(), opsys_string.size(), 0, &bytes_written, &error);

  if(error)
    Error::throw_exception(error);

  const ScopedPtr<char> scoped_buf (buf);
  return Glib::ustring(scoped_buf.get(), scoped_buf.get() + bytes_written);
}


Generated by  Doxygen 1.6.0   Back to index