See my report to the tlbuild mailing list explaining the details of problems with libiconv on FreeBSD.
I would basically like to ask you to replace your own implementation of iconv trickery with something that takes care of weird corner cases. The "only" required change would be this one:
--- texk/xdvik/configure.ac (revision 47244) +++ texk/xdvik/configure.ac (working copy) @@ -114,7 +114,7 @@ AC_CHECK_HEADERS([netdb.h sys/bsdtypes.h sys/param.h unistd.h sys/fcntl.h regex.h]) # Checks for iconv -XDVI_CHECK_ICONV +AM_ICONV # Checks for langinfo XDVI_CHECK_LANGINFO
along with putting the required files under m4
. See this post for another hint about how to best achieve that.
For this change to work, you need to add the following files from gnulib: