l = strlen(name);
ch->ch_sname = cp = malloc(l + 1);
- n2 = utf8toprintable(name);
+ n2 = strdup(name);
for(i = 0; i < strlen(n2); i++) {
c = tolower(n2[i]);
}
-
-
-static char *
-convert_to(const char *in, const char *target_encoding)
-{
- iconv_t ic;
- size_t inlen, outlen, alloced, pos;
- char *out, *start;
- int r;
-
- inlen = strlen(in);
- alloced = 100;
- outlen = alloced;
-
- ic = iconv_open(target_encoding, "UTF8");
- if(ic == NULL)
- return NULL;
-
- out = start = malloc(alloced + 1);
-
- while(inlen > 0) {
- r = iconv(ic, (char **)&in, &inlen, &out, &outlen);
-
- if(r == (size_t) -1) {
- if(errno == EILSEQ) {
- in++;
- inlen--;
- continue;
- }
-
- if(errno == E2BIG) {
- pos = alloced - outlen;
- alloced *= 2;
- start = realloc(start, alloced + 1);
- out = start + pos;
- outlen = alloced - pos;
- continue;
- }
- break;
- }
- }
-
- iconv_close(ic);
- pos = alloced - outlen;
- start[pos] = 0;
- return start;
-}
-
-
-
-
-
-char *
-utf8toprintable(const char *in)
-{
- return convert_to(in, "ISO_8859-1");
-}
-
-char *
-utf8tofilename(const char *in)
-{
- return convert_to(in, "LATIN1");
-}
-
-
-
-
/**
*
*/
#endif
-char *utf8toprintable(const char *in);
-char *utf8tofilename(const char *in);
const char *streaming_component_type2txt(streaming_component_type_t s);
static inline unsigned int tvh_strhash(const char *s, unsigned int mod)