+void utf16toutf8(char *c,int n)
+{
+ /* check whether the we need to convert UTF-16 to UTF-8 strings */
+ if ( ( c[0] != '\377' ) || ( c[1] != '\376' ) ) { return; }
+ /* only continue here, if the first 2 letters are 0xfffe *
+ * c references an UTF-16 input, where latin letters are *
+ * separated by zero bytes, which we need to eliminate */
+ int i=0; --n;
+ for(int j=2; (j<n) && (j<MAX_ITEM); j++ ) {
+ if( isprint(c[j]) ) { /* this is not perfect ! */
+ c[i++]=c[j];
+ } } c[i+1]=c[i]='\0';
+ /* the index i follows the zero-terminated "string" *
+ * now the read buffer is modified, not the file */
+ return;
+}
+