Re: Handling utf8 data from SQLite

On Sun, 11 Sep 2011 00:16:46 +1000
Zettai Muri <zettaimuri gmail com> wrote:
> > Why not catch the exception and print it out to find out?
> To be honest I don't know how to do this but will try to see if I can
> work it out.

This is basic C++:

try {
  std::cout << "DB - Password: " << password << std::endl;
catch (Glib::Exception& e) {
  std::cerr << e.what().raw() << std::endl;
catch (std::exception& e) {
  std::cerr << e.what() << std::endl;


> If I declare a string as Glib::ustring does this mean it is in utf8?
> Both username and password are declared as Glib::ustrings

If you are using a library provided by others which returns a string by
Glib::ustring, it is reasonable to assume the encoding is utf-8 (if it
isn't, file a bug with the library author). If you are providing
your own text to put in a Glib::ustring object, it is up to you to get
the encoding right. If you declare a string as Glib::ustring then you
must only put text in utf-8 encoding in it.  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]