[MPlayer-dev-eng] [PATCH] Filename double-conversion

Zuxy Meng zuxy.meng at gmail.com
Wed Oct 25 08:01:57 CEST 2006


2006/10/25, Rich Felker <dalias at aerifal.cx>:
> On Wed, Oct 25, 2006 at 09:20:06AM +0800, Zuxy Meng wrote:
> > First convert to utf-8 for input of mp_msg, then convert to
> > mp_msg_charset for actually displaying, as suggested by Rich.
>
> > +const char* filename_to_utf8(char* filename)
> > +{
> > +#ifndef USE_ICONV
> > +    return filename;
> > +#else
> > +    size_t filename_len, max_path;
> > +    char* putf8_filename;
> > +    if (!strcasecmp(mp_msg_charset, "UTF-8"))
> > +     return filename;
> > +    if (inv_msgiconv == (iconv_t)(-1)) {
> > +     inv_msgiconv = iconv_open("UTF-8", mp_msg_charset);
> > +     if (inv_msgiconv == (iconv_t)(-1))
> > +         return filename;
> > +    }
> > +    filename_len = strlen(filename);
> > +    max_path = MAX_PATH - 1;
> > +    putf8_filename = utf8_filename;
> > +    iconv(inv_msgiconv, (const char**)&filename, &filename_len,
> > +         &putf8_filename, &max_path);
> > +    *putf8_filename = '\0';
> > +    return utf8_filename;
> > +#endif
> > +}
> > +
>
> Looks good! But IMO you need to handle the case where mp_msg_charset
> is "noconv", if that's still supported. Or maybe we can remove it
> now..?

You remind me: mplayer still support MSG_CHARSET != UTF-8
-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6



More information about the MPlayer-dev-eng mailing list