Stable: 2.5.2
Development: 2.6-alpha3
hi all, i wrote patch for optional usage of native filesystem encoding, instead of tries to iconv() names.
moc-2.4.4 stable
diff -Naur moc-2.4.4/config.example moc-2.4.4.new/config.example
--- moc-2.4.4/config.example 2008-04-11 21:54:50.000000000 +0600
+++ moc-2.4.4.new/config.example 2010-06-28 01:05:43.000000000 +0600
@@ -125,6 +125,10 @@
# if UseRCC is set to yes.
#ID3v1TagsEncoding = WINDOWS-1250
+# Do not try to convert filenames and inconvertable tags
+# May bring back national charset, instead of '#'-s
+#NativeFSEncoding = yes
+
# Use librcc to fix ID3 version 1/1.1 tags encoding.
#UseRCC = yes
diff -Naur moc-2.4.4/options.c moc-2.4.4.new/options.c
--- moc-2.4.4/options.c 2007-05-23 00:24:34.000000000 +0600
+++ moc-2.4.4.new/options.c 2010-06-28 00:45:51.000000000 +0600
@@ -217,6 +217,7 @@
option_add_int ("SetXtermTitle", 1);
option_add_int ("PlaylistFullPaths", 1);
option_add_int ("Allow24bitOutput", 0);
+ option_add_int ("NativeFSEncoding", 0);
}
/* Return 1 if a parameter to an integer option is valid. */
@@ -243,6 +244,7 @@
|| !strcasecmp(name, "SetXtermTitle")
|| !strcasecmp(name, "PlaylistFullPaths")
|| !strcasecmp(name, "Allow24bitOutput")
+ || !strcasecmp(name, "NativeFSEncoding")
) {
if (!(val == 1 || val == 0))
return 0;
diff -Naur moc-2.4.4/utf8.c moc-2.4.4.new/utf8.c
--- moc-2.4.4/utf8.c 2007-02-11 17:40:13.000000000 +0500
+++ moc-2.4.4.new/utf8.c 2010-06-28 00:57:47.000000000 +0600
@@ -44,9 +44,11 @@
#include "common.h"
#include "log.h"
#include "utf8.h"
+#include "options.h"
static char *terminal_charset = NULL;
static int using_utf8 = 0;
+static int NativeFSEncoding = 0;
static iconv_t iconv_desc = (iconv_t)(-1);
@@ -63,7 +65,7 @@
if (!str)
return NULL;
- if (desc == (iconv_t)(-1))
+ if (desc == (iconv_t)(-1) || (NativeFSEncoding && str[strlen(str)-1] == '/'))
return xstrdup (str);
str_copy = inbuf = xstrdup (str);
@@ -78,13 +80,16 @@
&outbytesleft)
== (size_t)(-1)) {
if (errno == EILSEQ) {
- inbuf++;
inbytesleft--;
if (!--outbytesleft) {
*outbuf = 0;
break;
}
- *(outbuf++) = '#';
+ if (!NativeFSEncoding)
+ *(outbuf++) = '#';
+ else
+ *(outbuf++) = *inbuf;
+ inbuf++;
}
else if (errno == EINVAL) {
*(outbuf++) = '#';
@@ -320,6 +325,7 @@
if (iconv_desc == (iconv_t)(-1))
logit ("iconv_open() failed: %s", strerror(errno));
}
+ NativeFSEncoding = options_get_int("NativeFSEncoding");
}
void utf8_cleanup ()