--- mplayer/mp_msg.h.orig	2008-04-11 20:54:09.000000000 +0400
+++ mplayer/mp_msg.h	2008-04-12 03:23:30.000000000 +0400
@@ -128,6 +128,16 @@
 #   endif
 #endif /* __GNUC__ */
 
+#ifdef USE_ICONV
+#include <iconv.h>
+#endif /* USE_ICONV */
+
+/* maximum message length of mp_msg */
+#define MSGSIZE_MAX 3072
+
+const char* filename_recode_common(iconv_t inv_msgiconv, 
+    const char* filename,const char *tocode, const char *fromcode);
+
 const char* filename_recode(const char* filename);
 
 #endif /* MPLAYER_MP_MSG_H */
--- mplayer/mp_msg.c.orig	2008-02-22 12:18:17.000000000 +0300
+++ mplayer/mp_msg.c	2008-04-12 04:29:25.000000000 +0400
@@ -24,9 +24,6 @@
 #endif
 #include "mp_msg.h"
 
-/* maximum message length of mp_msg */
-#define MSGSIZE_MAX 3072
-
 int mp_msg_levels[MSGT_MAX]; // verbose level of this module. initialized to -2
 int mp_msg_level_all = MSGL_STATUS;
 int verbose = 0;
@@ -36,37 +33,57 @@
 static iconv_t msgiconv;
 #endif
 
-const char* filename_recode(const char* filename)
+// recode filename from <tocode> to <fromcode> charset;
+inline const char* filename_recode_common(iconv_t inv_msgiconv, 
+    const char* filename,const char *tocode, const char *fromcode)
 {
 #if !defined(USE_ICONV) || !defined(MSG_CHARSET)
     return filename;
 #else
-    static iconv_t inv_msgiconv = (iconv_t)(-1);
     static char recoded_filename[MSGSIZE_MAX];
     size_t filename_len, max_path;
     char* precoded;
-    if (!mp_msg_charset ||
-        !strcasecmp(mp_msg_charset, MSG_CHARSET) ||
-        !strcasecmp(mp_msg_charset, "noconv"))
+    if (!strcasecmp(fromcode, tocode))
         return filename;
     if (inv_msgiconv == (iconv_t)(-1)) {
-        inv_msgiconv = iconv_open(MSG_CHARSET, mp_msg_charset);
-        if (inv_msgiconv == (iconv_t)(-1))
+        inv_msgiconv = iconv_open(tocode, fromcode);
+        if (inv_msgiconv == (iconv_t)(-1)) {
+            mp_msg(MSGT_GLOBAL, MSGL_ERR,
+                    "iconv: conversion from %s to %s unsupported\n",
+                    fromcode, tocode); 
             return filename;
+        }
     }
     filename_len = strlen(filename);
     max_path = MSGSIZE_MAX - 4;
     precoded = recoded_filename;
     if (iconv(inv_msgiconv, &filename, &filename_len,
-              &precoded, &max_path) == (size_t)(-1) && errno == E2BIG) {
+              &precoded, &max_path) == (size_t)(-1)) {
+        //storage for errno, we may use it twice
+        int temp = errno;
+        if (temp == E2BIG) {
         precoded[0] = precoded[1] = precoded[2] = '.';
         precoded += 3;
+        }
+        mp_msg(MSGT_GLOBAL, MSGL_ERR,
+                "iconv: conversion from %s to %s failed because of %s\n",
+                fromcode, tocode, strerror(temp)); 
     }
     *precoded = '\0';
     return recoded_filename;
 #endif
 }
 
+const char* filename_recode(const char* filename)
+{
+    static iconv_t inv_msgiconv = (iconv_t)(-1);
+    if (mp_msg_charset && strcasecmp(mp_msg_charset, "noconv"))
+        return filename_recode_common(inv_msgiconv, filename, 
+                                      MSG_CHARSET, mp_msg_charset);
+    else
+        return filename;
+}
+
 void mp_msg_init(void){
     int i;
     char *env = getenv("MPLAYER_VERBOSE");
