diff audacious/util.c @ 2015:200970e7a3b1 trunk

[svn] - run chardet against even valid UTF-8 strings, as they may be non-UTF-8 sequences encoded as UTF-8.
author nenolod
date Mon, 27 Nov 2006 15:38:11 -0800
parents edc01e85648d
children d3a62e1075e2
line wrap: on
line diff
--- a/audacious/util.c	Sun Nov 26 15:57:59 2006 -0800
+++ b/audacious/util.c	Mon Nov 27 15:38:11 2006 -0800
@@ -1542,14 +1542,14 @@
      * encodings. To avoid this, the order of evaluation has been
      * changed. (It might cause a drawback?)
      */
+    /* chardet encoding detector */
+    if ((out_str = chardet_to_utf8(str, strlen(str), NULL, NULL, NULL)))
+        return out_str;
+
     /* already UTF-8? */
     if (g_utf8_validate(str, -1, NULL))
         return g_strdup(str);
 
-    /* chardet encoding detector */
-    if ((out_str = chardet_to_utf8(str, strlen(str), NULL, NULL, NULL)))
-        return out_str;
-
     /* assume encoding associated with locale */
     if ((out_str = g_locale_to_utf8(str, -1, NULL, NULL, NULL)))
         return out_str;