[tracker] libtracker-common: Improve logging when guessing charsets



commit af7d8a4ddcfa711e426d51bcfd2fd5856f974f50
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Feb 25 15:16:55 2011 +0100

    libtracker-common: Improve logging when guessing charsets

 src/libtracker-common/tracker-encoding-enca.c      |    3 +++
 .../tracker-encoding-meegotouch.cpp                |   18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-common/tracker-encoding-enca.c b/src/libtracker-common/tracker-encoding-enca.c
index 1b034ff..8bc4f3e 100644
--- a/src/libtracker-common/tracker-encoding-enca.c
+++ b/src/libtracker-common/tracker-encoding-enca.c
@@ -52,5 +52,8 @@ tracker_encoding_guess_enca (const gchar *buffer,
 
 	free (langs);
 
+	if (encoding)
+		g_debug ("Guessing charset as '%s'", encoding);
+
 	return encoding;
 }
diff --git a/src/libtracker-common/tracker-encoding-meegotouch.cpp b/src/libtracker-common/tracker-encoding-meegotouch.cpp
index 9c3a086..28573d0 100644
--- a/src/libtracker-common/tracker-encoding-meegotouch.cpp
+++ b/src/libtracker-common/tracker-encoding-meegotouch.cpp
@@ -52,7 +52,23 @@ tracker_encoding_guess_meegotouch (const gchar *buffer,
 
 	gchar *encoding = g_strdup (bestMatch.name ().toUtf8 ().data ());
 
-	g_debug ("Guessing charset as '%s' with %d confidence",
+#if 0
+	QList<MCharsetMatch> mCharsetMatchList = detector.detectAll();
+
+	if (detector.hasError ()) {
+		g_warning ("Charset detector error when detecting all: %s",
+		           detector.errorString ().toUtf8 (). data ());
+	}
+
+	g_debug ("Detecting all charsets...");
+	for (gint i = 0; i < mCharsetMatchList.size (); ++i) {
+		g_debug ("  Charset '%s' with %d%% confidence...",
+		         mCharsetMatchList[i].name (). toUtf8 ().data (),
+		         mCharsetMatchList[i].confidence ());
+	}
+#endif
+
+	g_debug ("Guessing charset as '%s' with %d%% confidence",
 	         encoding, bestMatch.confidence ());
 
 	return encoding;



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