[MPlayer-dev-eng] [PATCH] ftp charset selection support
Andrew Savchenko
Bircoph at list.ru
Sat Apr 12 03:45:59 CEST 2008
Hello,
Currently there are a lot of ftp servers with different charsets
and it is a problem to work with these hosts if local encoding
differs, only for Russian there are over 10 different encoding and
3 of them are widely used. So I made a patch which allows to
select remote server's encoding and recode URL into it.
I've found that function for filename recoding already exists:
filename_recode() in mp_msg.c, so I changed it in order to recode
from arbitrary initial encoding to arbitrary final one. I
extracted common part to filename_recode_common() and added iconv
error handling routines (otherwise iconv silently fails if e.g.
incorrect encoding is specified.). iconv_t handlers are separate
for each "branch" of convertios, because both strcmp() and
iconv_open()/iconv_close() are expensive operations to be
performed each time. This is what the first patch supposed to do.
The second patch is just cosmetics required after the first patch.
The third patch is ftp URL recoding support itself utilizing the
first patch.
And the fourth patch is man page update describes new -ftp-charset
option.
Currently user must specify encoding on his/her own, but in several
cases it is possible to autodetect encoding:
1) Negotiation with server using LANG feature (rfc2640) if server
supports it.
2) Alternatively try to server's guess encoding by descendingly
parsing directories in URL (starting from /) in order to identify
encoding using ENCA.
This will be implemented later, I hope.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftp-charset-filename_recode.patch
Type: text/x-diff
Size: 3230 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080412/dd76fd4e/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftp-charset-filename_recode-cosmetics.patch
Type: text/x-diff
Size: 537 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080412/dd76fd4e/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftp-charset.patch
Type: text/x-diff
Size: 2357 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080412/dd76fd4e/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftp-charset-manual.patch
Type: text/x-diff
Size: 585 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080412/dd76fd4e/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080412/dd76fd4e/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list