diff -ruN id3lib-3.8.3-orig/ChangeLog id3lib-3.8.3/ChangeLog
--- id3lib-3.8.3-orig/ChangeLog	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/ChangeLog	2020-05-31 08:17:25.000000000 -0500
@@ -1,3 +1,8 @@
+2006-02-17  Jerome Couderc
+
+    * Patch from Spoon to fix UTF-16 writing bug
+      http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
+
 2003-03-02 Sunday 17:38   Thijmen Klok <thijmen@id3lib.org>
 
 	* THANKS (1.20): added more people 
diff -ruN id3lib-3.8.3-orig/Makefile.am id3lib-3.8.3/Makefile.am
--- id3lib-3.8.3-orig/Makefile.am	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/Makefile.am	2020-05-31 08:17:25.000000000 -0500
@@ -11,6 +11,7 @@
 
 # require automake 1.5
 AUTOMAKE_OPTIONS = 1.5
+ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST =                    \
         HISTORY                 \
diff -ruN id3lib-3.8.3-orig/configure.in id3lib-3.8.3/configure.in
--- id3lib-3.8.3-orig/configure.in	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/configure.in	2020-05-31 08:17:25.000000000 -0500
@@ -11,11 +11,12 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-# require autoconf 2.13
-AC_PREREQ(2.13)
+# require autoconf 2.63
+AC_PREREQ(2.63)
 
 # init autoconf (and check for presence fo reconf)
 AC_INIT(reconf)
+AC_CONFIG_MACRO_DIR([m4])
 
 ID3LIB_NAME=id3lib
 
@@ -83,7 +84,7 @@
 
 AC_SUBST(ID3LIB_FULLNAME)
 
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 
 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
 
@@ -168,7 +169,7 @@
 		iconv_oldstyle=1, iconv_oldstyle=0)
   if test $iconv_oldstyle = 1; then
     AC_MSG_RESULT(const char **)
-    AC_DEFINE(ID3LIB_ICONV_OLDSTYLE)
+    AC_DEFINE(ID3LIB_ICONV_OLDSTYLE, 1, [Desc])
     #we'll check out the need of
     #typecast in the call of iconv_open
     AC_MSG_CHECKING(whether to typecast in iconv)
@@ -184,7 +185,7 @@
                    iconv_cast=0, iconv_cast=1)
     if test $iconv_cast = 1; then
       AC_MSG_RESULT(yes)
-      AC_DEFINE(ID3LIB_ICONV_CAST_OK)
+      AC_DEFINE(ID3LIB_ICONV_CAST_OK, 1, [Desc])
     else
       AC_MSG_RESULT(no)
     fi
@@ -206,7 +207,7 @@
                    iconv_cast=0, iconv_cast=1)
     if test $iconv_cast = 1; then
       AC_MSG_RESULT(yes)
-      AC_DEFINE(ID3LIB_ICONV_CAST_OK)
+      AC_DEFINE(ID3LIB_ICONV_CAST_OK, 1, [Desc])
     else
       AC_MSG_RESULT(no)
     fi
@@ -227,7 +228,6 @@
 )
 AC_CHECK_HEADERS(               \
   string                        \
-  iomanip.h                     \
   ,,AC_MSG_ERROR([Missing a vital header file for id3lib])
 )
 
@@ -296,12 +296,6 @@
 AC_DEFINE_UNQUOTED(_ID3LIB_BINARY_AGE,            $ID3LIB_BINARY_AGE)
 AC_DEFINE_UNQUOTED(_ID3_COMPILED_WITH_DEBUGGING, "${enable_debug}")
 
-CONDITIONAL_SUBDIRS=
-if test "x$ac_cv_lib_z_uncompress" = "xno"; then
-  CONDITIONAL_SUBDIRS="$CONDITIONAL_SUBDIRS zlib"
-fi
-AC_CONFIG_SUBDIRS(zlib)
-
 CFLAGS="$CFLAGS -Wall"
 
 AC_OUTPUT(                      \
diff -ruN id3lib-3.8.3-orig/examples/demo_convert.cpp id3lib-3.8.3/examples/demo_convert.cpp
--- id3lib-3.8.3-orig/examples/demo_convert.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_convert.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -84,7 +84,7 @@
   }
 }
 
-int main( unsigned int argc, char * const argv[])
+int main(int argc, char * const argv[])
 {
   flags_t ulFlag = ID3TT_ALL;
   gengetopt_args_info args;
diff -ruN id3lib-3.8.3-orig/examples/demo_copy.cpp id3lib-3.8.3/examples/demo_copy.cpp
--- id3lib-3.8.3-orig/examples/demo_copy.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_copy.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -81,7 +81,7 @@
   }
 }
 
-int main( unsigned int argc, char * const argv[])
+int main(int argc, char * const argv[])
 {
   int ulFlag = ID3TT_ID3;
   ID3D_INIT_DOUT();
diff -ruN id3lib-3.8.3-orig/examples/demo_info.cpp id3lib-3.8.3/examples/demo_info.cpp
--- id3lib-3.8.3-orig/examples/demo_info.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_info.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -309,7 +309,7 @@
 
 #define DEBUG
 
-int main( unsigned int argc, char * const argv[])
+int main(int argc, char * const argv[])
 {
   ID3D_INIT_DOUT();
 
diff -ruN id3lib-3.8.3-orig/examples/demo_tag.cpp id3lib-3.8.3/examples/demo_tag.cpp
--- id3lib-3.8.3-orig/examples/demo_tag.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_tag.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -46,7 +46,7 @@
     os << "v2";
 }
 
-int main( unsigned int argc, char * const argv[])
+int main(int argc, char * const argv[])
 {
   int ulFlag = ID3TT_ID3;
   ID3D_INIT_DOUT();
diff -ruN id3lib-3.8.3-orig/examples/findeng.cpp id3lib-3.8.3/examples/findeng.cpp
--- id3lib-3.8.3-orig/examples/findeng.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/findeng.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -9,7 +9,7 @@
 using std::cout;
 using std::endl;
 
-int main(unsigned argc, char* argv[])
+int main(int argc, char* argv[])
 {
   ID3D_INIT_DOUT();
   ID3D_INIT_WARNING();
diff -ruN id3lib-3.8.3-orig/examples/findstr.cpp id3lib-3.8.3/examples/findstr.cpp
--- id3lib-3.8.3-orig/examples/findstr.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/findstr.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -9,7 +9,7 @@
 using std::cout;
 using std::endl;
 
-int main(unsigned argc, char* argv[])
+int main(int argc, char* argv[])
 {
   ID3D_INIT_DOUT();
   ID3D_INIT_WARNING();
diff -ruN id3lib-3.8.3-orig/examples/test_io.cpp id3lib-3.8.3/examples/test_io.cpp
--- id3lib-3.8.3-orig/examples/test_io.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/test_io.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -4,6 +4,8 @@
 #  include <config.h>
 #endif
 
+using namespace std;
+
 #include <id3/readers.h>
 #include <id3/writers.h>
 #include <id3/io_decorators.h>
@@ -18,7 +20,7 @@
 using namespace dami;
 
 int
-main(size_t argc, const char** argv)
+main(int argc, const char** argv)
 {
   ID3D_INIT_DOUT();
   ID3D_INIT_WARNING();
diff -ruN id3lib-3.8.3-orig/m4/id3_cxx.m4 id3lib-3.8.3/m4/id3_cxx.m4
--- id3lib-3.8.3-orig/m4/id3_cxx.m4	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/m4/id3_cxx.m4	2020-05-31 08:17:25.000000000 -0500
@@ -81,7 +81,7 @@
 
   dnl Check whether we have bool
   AC_MSG_CHECKING(whether C++ has bool)
-  AC_TRY_RUN([main() { bool b1=true; bool b2=false; }],
+  AC_TRY_RUN([int main() { bool b1=true; bool b2=false; return 0; }],
              [ AC_MSG_RESULT(yes) ],
              [ AC_MSG_RESULT(no)
                AC_DEFINE(CXX_HAS_NO_BOOL) ],
diff -ruN id3lib-3.8.3-orig/src/Makefile.am id3lib-3.8.3/src/Makefile.am
--- id3lib-3.8.3-orig/src/Makefile.am	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/src/Makefile.am	2020-05-31 08:17:25.000000000 -0500
@@ -74,9 +74,11 @@
 
 if ID3_NEEDZLIB
 LDADD        = $(top_builddir)/zlib/src/libz.la
+else
+libid3_la_LIBADD  = -lz
 endif
 
 libid3_la_LDFLAGS = \
   -version-info $(LT_VERSION) \
-  -release $(LT_RELEASE) \
+  -no-undefined \
   -export-dynamic
diff -ruN id3lib-3.8.3-orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp
--- id3lib-3.8.3-orig/src/io_helpers.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/src/io_helpers.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -363,11 +363,22 @@
     // Write the BOM: 0xFEFF
     unicode_t BOM = 0xFEFF;
     writer.writeChars((const unsigned char*) &BOM, 2);
+    // Patch from Spoon : 2004-08-25 14:17
+    //   http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
+    // Wrong code
+    //for (size_t i = 0; i < size; i += 2)
+    //{
+    //  unicode_t ch = (data[i] << 8) | data[i+1];
+    //  writer.writeChars((const unsigned char*) &ch, 2);
+    //}
+    // Right code
+    unsigned char *pdata = (unsigned char *) data.c_str();
     for (size_t i = 0; i < size; i += 2)
     {
-      unicode_t ch = (data[i] << 8) | data[i+1];
+      unicode_t ch = (pdata[i] << 8) | pdata[i+1];
       writer.writeChars((const unsigned char*) &ch, 2);
     }
+    // End patch
   }
   return writer.getCur() - beg;
 }
diff -ruN id3lib-3.8.3-orig/src/mp3_parse.cpp id3lib-3.8.3/src/mp3_parse.cpp
--- id3lib-3.8.3-orig/src/mp3_parse.cpp	2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/src/mp3_parse.cpp	2020-05-31 08:17:25.000000000 -0500
@@ -465,7 +465,7 @@
   // from http://www.xingtech.com/developer/mp3/
 
   const size_t VBR_HEADER_MIN_SIZE = 8;     // "xing" + flags are fixed
-  const size_t VBR_HEADER_MAX_SIZE = 116;   // frames, bytes, toc and scale are optional
+  const size_t VBR_HEADER_MAX_SIZE = 120;   // frames, bytes, toc and scale are optional
 
   if (mp3size >= vbr_header_offest + VBR_HEADER_MIN_SIZE) 
   {
