Re: Error opening dictionary with php pspell function pspell_new

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Glyn,

Within the english dictionaries distributed by the win32 port of aspell,
there are two 
files in the data directory that are screwed.  They are ISO8859-1.dat and 
standard.krb.  They have dos carriage returns in them.  Running a unix
dos2unix 
command on them, and replacing them will fix the problem.  If you don't
have 
access to a unix box, this website does the trick:
http://www.iconv.com/dos2unix.htm

Best,
Drew

Glyn Burton wrote:

> I'm trying to get up and running using the pspell functions on Windows. 
> It seems everything is installed OK. I can use aspell from the Windows 
> command prompt fine. PHP thinks the pspell module is loaded OK.

> However, when I try to execute the pspell_new function I get the 
> following: -
> 	"Warning: PSPELL couldn't open the dictionary. reason: No word lists 
> can be found for the language "en". in ..."

> I have installed both an english and welsh dictionary and they both work 
> find using aspell from the Windows command prompt.

> The strange thing is that if I call pspell_new twice then it seems to 
> succeed 2nd time. See code sample and correctsponding output below: -
> CODE
>                 /* Set up test data */
>                  $cWords[0] = "good";
>                  $cWords[1] = "badd";
>                  $numWords = count($cWords);

>                  /* Load the dictionary */
>                  $pDict = pspell_new("en");
>                  echo("pDict is $pDict<br>n");
>                  $pDict = pspell_new("en");
>                  echo("pDict is $pDict<br>n");

>                  /* Check the words */
>                  for($i=0; $i<$numWords; $i++)
>                  {
>                      if(pspell_check($pDict, $cWords[$i]))
>                          echo("$cWords[$i] is spelled OK<br>n");
>                      else
>                          echo("$cWords[$i] is misspelled<br>n");
>                  }

> OUTPUT
> Warning: PSPELL couldn't open the dictionary. reason: No word lists can 
> be found for the language "en". in C:Program FilesApache 
> GroupApache2htdocsphpRemoteAdstractpreview.php on line 22
>   pDict is
>   pDict is 2
>   good is spelled OK
>   badd is misspelled

> ENVIRONMENT
> 	Windows XP service pack 1
> 	PHP 4.3.8
> 	Aspell 0.50.3
> 	Apache 2.0.47

> Any advice or suggestion appreciated.

> 	- Glyn

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux