Re: Charsets, Gtkmm and MySQL



Are you using Glib::ustring anywhere in the process of getting the data from the SQL database to the view?

Glib::ustring implicitly (and in my opinion still at least not well enough documented/hinted at) converts from UTF-8
to the current locale with operators << and >>. If you are using a stringstream anywhere in the process, or are
using operator<< or operator>> in any other way, this could then be the cause of the problem.

Otherwise, and in the above described case too actually it would help very much if you could post (if possible, all of)
the relevant code online.

Regards,
M.

On Sun, Dec 28, 2008 at 8:53 PM, Bernd Robertz <bernd robertz cssweb de> wrote:
Hello list,

I'm not really sure, but I hope My question is in the right place here.

I wrote a simple database app like this:

Connect to a MySQL server via libmysql++,
and then list the rows in a treeview.
Doubleclick on a row shows a window with some entries and a textview
with the content of the selected row.
The textview is associated with a type text in the DB.

Everything is fine.

So but I ran really into problems with the charsets.
german umlaute (ö, ä, etc.) and some other characters are glyphs in the
treeview. Ok, thats not the main problem.

That is: The entries in the detailed view still shows the glyphs for
some chars like ö, ä.
But on some rows, the represented textbuffer for textview is not
visible. Wich means the textview is in some rows empty.

I run My app from a console and I got these error messages:

:::::::::
Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate
(text, len, NULL)' failed
:::::::::

In other rows, the textbuffer is correct shown, exepct some glyphs.

If I print the textbuffer as a simple .c_str() in a console it will be
shown correctly (inklusive ä, ö, ü...).
(Tried to show the textview as a .c_str(), without any effect.)

The SQL connection is serverside-configured as UTF-8 Unicode.
The SQL table collation is UTF-8 General CI (Case Insensitive).
The Application runs on a DE_de Euro (ISO-8859-15).

All characters are shown correctly in a PHP app wich does the same, just
only online. :-)

I hope someone could turn on a light above my head, why I don't get the
right charactes.

Thanks alot in advance

Bernd


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



--
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]


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