rsync-3.0.0pre10 and iconv

sami.pitko at vaisala.com sami.pitko at vaisala.com
Wed Feb 27 10:02:22 GMT 2008


Hello,

> Has anyone got iso8859-1 to utf-8 conversion working with
rsync-3.0.0pre10? 

I am answering to my own question.

I looked at the setup_iconv function in rsync.c and found following code
snippets:

...
        if ((ic_send = iconv_open(UTF8_CHARSET, charset)) ==
(iconv_t)-1) {
...

...
        if ((ic_recv = iconv_open(charset, UTF8_CHARSET)) ==
(iconv_t)-1) {
...

According to man 3 iconv_open:

       iconv_t iconv_open(const char *tocode, const char *fromcode);

So if I'm interpreting that right, UTF8 is hardcoded to always be one of
the conversion charsets. If rsync is sending, the conversion is always
to UTF8. If rsync is receiving, the conversion is always from UTF8.

To verify above, I tested to transfer the same two files to the other
direction (conversion from utf-8 to iso8859-1) and it worked properly.

Is --iconv option intentionally limited to only work from UTF8 charset?

Regards,
Sami


More information about the rsync mailing list