diff -u -r -N -x CVS -x WIN32_20.1_i386_DBG --minimal abi.org/src/other/spell/ispell.h abi/src/other/spell/ispell.h
--- abi.org/src/other/spell/ispell.h	Sun Nov 28 16:42:44 1999
+++ abi/src/other/spell/ispell.h	Sat Dec 18 21:49:26 1999
@@ -343,6 +343,7 @@
 long whatcap (ichar_t* word);
 int hash (ichar_t* s, int hashtblsize);
 void makepossibilities(ichar_t* word);
+int	findfiletype (char * name, int searchnames, int * deformatter);
 
 #endif
 
@@ -653,7 +654,7 @@
 				    > 0)
 #define l1_isstringch(ptr, len, canon)	\
 				(len = 1, \
-				  isstringstart (*(ptr)) \
+				  isstringstart ((unsigned char)(*(ptr))) \
 				    &&  ((len = \
 					  stringcharlen ((ptr), (canon))) \
 					> 0 \
diff -u -r -N -x CVS -x WIN32_20.1_i386_DBG --minimal abi.org/src/other/spell/makedent.c abi/src/other/spell/makedent.c
--- abi.org/src/other/spell/makedent.c	Sun Nov 28 16:42:48 1999
+++ abi/src/other/spell/makedent.c	Sat Dec 18 21:49:52 1999
@@ -491,7 +491,7 @@
 	if (l1_isstringch (in, len, canonical))
 	    *out++ = SET_SIZE + laststringch;
 	else
-	    *out++ = *in;
+	    *out++ = (unsigned char)( *in );
 	}
     *out = 0;
     return outlen <= 0;
diff -u -r -N -x CVS -x WIN32_20.1_i386_DBG --minimal abi.org/src/other/spell/newMain.c abi/src/other/spell/newMain.c
--- abi.org/src/other/spell/newMain.c	Thu Sep 30 01:33:32 1999
+++ abi/src/other/spell/newMain.c	Sat Dec 18 22:46:22 1999
@@ -1,8 +1,9 @@
 #include <stdlib.h>
-#include <string.h>
+#include <string.h>
 
 #include "ispell.h"
 #include "sp_spell.h"
+/*#include "ut_assert.h"*/
 
 /***************************************************************************/
 /* Reduced Gobals needed by ispell code.                                   */
@@ -32,7 +33,10 @@
 int      pcount;         /* Count of possibilities generated */
 int      maxposslen;     /* Length of longest possibility */
 int      easypossibilities; /* Number of "easy" corrections found */
-                                /* ..(defined as those using legal affixes) */
+                                /* ..(defined as those using legal affixes) */
+
+int deftflag = -1;				/* NZ for TeX mode by default */
+int prefstringchar = -1;		/* Preferred string character type */
 
 /*
  * The following array contains a list of characters that should be tried
@@ -49,7 +53,10 @@
 static int g_bSuccessfulInit = 0;
 
 int SpellCheckInit(char *hashname)
-{
+{
+	/* TODO use specific 'preftype' from config for this 'hashname' */
+	char *preftype = "latin1";
+
 	if (linit(hashname) < 0)
 	{
 		/* TODO gripe -- could not load the dictionary */
@@ -57,7 +64,25 @@
 		return 0;
 	}
 
-	g_bSuccessfulInit = 1;
+	g_bSuccessfulInit = 1;
+
+	if (preftype != NULL)
+	{
+		prefstringchar = findfiletype(preftype, 1, deftflag < 0 ? &deftflag : (int *) NULL);
+		/*
+		if (prefstringchar < 0
+			&& strcmp(preftype, "tex") != 0
+			&& strcmp(preftype, "nroff") != 0)
+		{
+			fprintf(stderr, ISPELL_C_BAD_TYPE, preftype);
+			exit (1);
+		}
+		*/
+	}
+	if (prefstringchar < 0)
+		defdupchar = 0;
+	else
+		defdupchar = prefstringchar;
 	
 	return 1;
 }
@@ -68,6 +93,8 @@
 }
 
 
+/* This function is not uptodate, see SpellCheckNWord16 and SpellCheckSuggestNWord16 */
+#if 0
 int SpellCheckWord16(unsigned short  *word16)
 {
 	int retVal;
@@ -84,46 +111,41 @@
 
 	return retVal;  /* returns 0 or 1 (boolean) */
 }
-
+#endif
 
 int SpellCheckNWord16(const unsigned short *word16, int length)
 {
 	int retVal;
-    ichar_t  *iWord;
-	register ichar_t *p;
+	ichar_t  iWord[INPUTWORDLEN + MAXAFFIXLEN];
+	char  word8[INPUTWORDLEN + MAXAFFIXLEN];
+	register char *p;
 	register int x;
 
 	if (!g_bSuccessfulInit)
-	{
 		return 1;
-	}
 
-	if (!word16)
+	if (!word16 || length >= (INPUTWORDLEN + MAXAFFIXLEN))
 		return 0;
 
-	/* TODO: modify good() to take a non-null terminated string so
-		we don't have to malloc() for this check */
-
-	if (!(iWord = (ichar_t *) malloc( ( sizeof(ichar_t) * (length+1)))))
-	{
-			return -1;
-	}
-
-	/* copy and null terminate */
-	for (x = 0, p = iWord; x < length; x++)
-	{
-		*p++ = *word16++;
-	}
-	*p = (ichar_t) 0;
-
-	
-	retVal = good(iWord, 0, 0, 1, 0);
-	free(iWord);
+	/* TODO: modify good() to take a non-null terminated string */
 
+	/* copy to 8bit string and null terminate */
+	/* TODO convert from Unicode, or give ispell Unicode support */
+	for (x = 0, p = word8; x < length; x++)
+		*p++ = *word16++;
+	*p = (ichar_t) 0;
+	
+/*UT_ASSERT(0);*/
+	if( !strtoichar(iWord, word8, sizeof(iWord), 0) )
+		retVal = good(iWord, 0, 0, 1, 0);
+	else
+		retVal = -1;
+
 	return retVal; /* 0 - not found, 1 on found, -1 on error */
-	
 }
 
+/* This function is not uptodate, see SpellCheckNWord16 and SpellCheckSuggestNWord16 */
+#if 0
 int SpellCheckSuggestWord16(unsigned short *word16, sp_suggestions *sg)
 {
    register int x, c, l;
@@ -159,58 +181,65 @@
 
    return sg->count;
 }
+#endif
 
 int SpellCheckSuggestNWord16(const unsigned short *word16, int length, sp_suggestions *sg)
 {
-   ichar_t  *iWord;
-   register ichar_t *p;
-   register int x, c, l;
-   
-   if (!g_bSuccessfulInit) return 0;
-   if (!word16) return 0;
-   if (!sg) return 0;
+	ichar_t  iWord[INPUTWORDLEN + MAXAFFIXLEN];
+	char  word8[INPUTWORDLEN + MAXAFFIXLEN];
+	register char *p;
+	register int x, c, l;
 
+	if (!g_bSuccessfulInit) 
+		return 0;
+	if (!word16 || length >= (INPUTWORDLEN + MAXAFFIXLEN))
+		return 0;
+	if (!sg) 
+		return 0;
+
+	/* TODO: modify good() to take a non-null terminated string */
+
+	/* copy to 8bit string and null terminate */
+	/* TODO convert from Unicode, or give ispell Unicode support */
+	for (x = 0, p = word8; x < length; x++)
+		*p++ = *word16++;
+	*p = (ichar_t) 0;
+	
+	if( !strtoichar(iWord, word8, sizeof(iWord), 0) )
+		makepossibilities(iWord);
+
+	sg->count = pcount;
+	sg->score = (short*)malloc(sizeof(short) * pcount);
+	sg->word = (short**)malloc(sizeof(short**) * pcount);
+	if (sg->score == NULL || sg->word == NULL) 
+	{
+		sg->count = 0;
+		return 0;
+	}
 
-   if (!(iWord = (ichar_t *) malloc( ( sizeof(ichar_t) * (length+1)))))
-     {
-	return 0;
-     }
-   
-   /* copy and null terminate */
-   for (x = 0, p = iWord; x < length; x++)
-     {
-	*p++ = *word16++;
-     }
-   *p = (ichar_t) 0;
-   
-   makepossibilities(iWord);
-   free(iWord);
-   
-   sg->count = pcount;
-   sg->score = (short*)malloc(sizeof(short) * pcount);
-   sg->word = (short**)malloc(sizeof(short**) * pcount);
-   if (sg->score == NULL || sg->word == NULL) {
-      sg->count = 0;
-      return 0;
-   }
-   
-   for (c = 0; c < pcount; c++) {
-      sg->score[c] = 1000;
-      l = 0;
-      while (possibilities[c][l]) l++;
-      l++;
-      sg->word[c] = (short*)malloc(sizeof(short) * l);
-      if (sg->word[c] == NULL) {
-	 /* out of memory, but return what was copied so far */
-	 sg->count = c;
-	 return c;
-      }
-      for (x = 0; x < l; x++) sg->word[c][x] = (short)possibilities[c][x];
-   }
+	for (c = 0; c < pcount; c++) 
+	{
+		sg->score[c] = 1000;
+		l = 0;
+		while (possibilities[c][l]) 
+			l++;
+		l++;
+		sg->word[c] = (short*)malloc(sizeof(short) * l);
+		if (sg->word[c] == NULL) 
+		{
+			/* out of memory, but return what was copied so far */
+			sg->count = c;
+			return c;
+		}
+		for (x = 0; x < l; x++) 
+			sg->word[c][x] = (unsigned char)possibilities[c][x];
+	}
 
-   return sg->count;
+	return sg->count;
 }
 
+/* This function is not uptodate, see SpellCheckNWord16 and SpellCheckSuggestNWord16 */
+#if 0
 int SpellCheckSuggestWord(char *word, sp_suggestions *sg)
 {
    char *pc;
@@ -270,10 +299,10 @@
 
    return sg->count;
 }
+#endif
 
-
-
-
+/* This function is not uptodate, see SpellCheckNWord16 and SpellCheckSuggestNWord16 */
+#if 0
 int SpellCheckWord(char *word)
 {
     char *pc;
@@ -309,8 +338,6 @@
 
 	free(iWord);
 
-	return retVal; /* return 0 not found, 1 on found */
-	
+	return retVal; /* return 0 not found, 1 on found */
 }
-
-
+#endif
diff -u -r -N -x CVS -x WIN32_20.1_i386_DBG --minimal abi.org/src/other/spell/sp_spell.h abi/src/other/spell/sp_spell.h
--- abi.org/src/other/spell/sp_spell.h	Thu Sep 30 01:33:32 1999
+++ abi/src/other/spell/sp_spell.h	Sat Dec 18 21:40:38 1999
@@ -23,11 +23,14 @@
 int SpellCheckInit(char *hashname);
 void SpellCheckCleanup(void);
 int SpellCheckNWord16(const unsigned short *word16, int length);
+int SpellCheckSuggestNWord16(const unsigned short *word16, int length, sp_suggestions *sg);
+/* This functions are not uptodate, see SpellCheckNWord16 and SpellCheckSuggestNWord16 */
+#if 0
 int SpellCheckWord16(unsigned short  *word16);
-int SpellCheckSuggestNWord16(const unsigned short *word16, int length, sp_suggestions *sg);
 int SpellCheckSuggestWord16(unsigned short  *word16, sp_suggestions *sg);
 int SpellCheckWord(char *word);
 int SpellCheckSuggestWord(char *word, sp_suggestions *sg);  
+#endif
 
 #ifdef __cplusplus
 }