Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 10-27-2009, 09:22 AM
Starter Member
 
Posts: 2
Default Spanish aspell 6.0.2

<?php
#
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Zimbra, Inc.
#
# The contents of this file are subject to the Yahoo! Public License
# Version 1.0 ("License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# Licensing for open source server & client technology: enterprise messaging and collaboration software by Zimbra.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
# ***** END LICENSE BLOCK *****
#

$filename = "";
$text = "";
$dictionary = "en_EN";

if (isset($_FILES["text"])) {
$text = file_get_contents($_FILES["text"]);
} else if (isset($_REQUEST["text"])){
$text = $_REQUEST["text"];
}

if (isset($_REQUEST["dictionary"])) {
$dictionary = $_REQUEST["dictionary"];
}

if (get_magic_quotes_gpc()) {
$text = stripslashes($text);
}

if ($text != NULL) {
header("Content-Type: text/plain");
set_error_handler("returnError");

setlocale(LC_ALL, $dictionary);

// Get rid of double-dashes, since we ignore dashes
// when splitting words
$text = preg_replace('/--+/', ' ', $text);

// Convert to ISO-8859-1
//$text = iconv("UTF-8","iso-8859-1", $text);


// Split on anything that's not a word character, quote or dash
$words = preg_split('/[^\w\'\xc0-\xfd-]+/', $text);
//$words = preg_split('/[^\w\xc0-\xfd-\']+/', $text);


// Load dictionary
$dictionary = pspell_new($dictionary);
if ($dictionary == 0) {
returnError("Unable to open dictionary " . $dictionary);
}

$skip = FALSE;
$checked_words = array();
$misspelled = "";

foreach ($words as $word) {
if ($skip) {
$skip = FALSE;
continue;
}

// Ignore hyphenations
if (preg_match('/-$/', $word)) {
// Skip the next word too
$skip = TRUE;
continue;
}

// Skip numbers
if (preg_match('/[0-9\-]+/', $word)) {
continue;
}

// Skip duplicates
if (array_key_exists($word, $checked_words)) {
continue;
} else {
$checked_words[$word] = 1;
}

// Check spelling
if (!pspell_check($dictionary, $word)) {
$suggestions = implode(",", pspell_suggest($dictionary, $word));
$suggestions = iconv("UTF-8","iso-8859-1//IGNORE",$suggestions);
$misspelled .= "$word:$suggestions\n";


}
}

echo $misspelled;
} else {
?>

<html>
<head>
<title>Spell Checker</title>
</head>
<body>

<form action="aspell.php" method="post" enctype="multipart/form-data">
<p>Type in some words to spell check:</p>
<textarea NAME="text" ROWS="10" COLS="80"></textarea>
<p>Dictionary:<input type="text" name="dictionary" value="<?=$dictionary; ?>" size="8"/></p>
<p><input type="submit" /></p>
</form>

</body>
</html>

<?php
}

function returnError($errno, $message) {
header("HTTP/1.1 500 Internal Server Error");
error_log("Error $errno: " . $message);
exit($message);
}

?>
Reply With Quote
  #12 (permalink)  
Old 10-27-2009, 03:12 PM
Junior Member
 
Posts: 5
Default

I prove this spanish aspell 6.0.2 in http://localhost:7780/aspell.php and..

http://localhost:7780/aspell.php (MULTIPART FORM DATA)
iconv() [<a href='function.iconv'>function.iconv</a>]: Detected an illegal character in input string


obiously in zimbra redaction doesn't work

any solution? Am I doing someting wrong?

thanks

Last edited by eloi; 10-27-2009 at 03:26 PM..
Reply With Quote
  #13 (permalink)  
Old 10-28-2009, 07:17 AM
Starter Member
 
Posts: 2
Default

Quote:
Originally Posted by eloi View Post
I prove this spanish aspell 6.0.2 in http://localhost:7780/aspell.php and..

http://localhost:7780/aspell.php (MULTIPART FORM DATA)
iconv() [<a href='function.iconv'>function.iconv</a>]: Detected an illegal character in input string


obiously in zimbra redaction doesn't work

any solution? Am I doing someting wrong?

thanks
you can prove with this code

// Convert to ISO-8859-1
//$text = iconv("UTF-8","iso-8859-1", $text);

// Split on anything that's not a word character, quote or dash
$words = preg_split('/[^\w\'\xc0-\xfd-]+/', $text);
//$words = preg_split('/[^\w\xc0-\xfd-\']+/', $text);

// Check spelling
if (!pspell_check($dictionary, $word)) {
$suggestions = implode(",", pspell_suggest($dictionary, $word));
$suggestions = iconv("UTF-8","iso-8859-1//IGNORE",$suggestions);
$misspelled .= "$word:$suggestions\n";
Reply With Quote
  #14 (permalink)  
Old 10-28-2009, 07:22 AM
Junior Member
 
Posts: 5
Default

I don't see the diference with Spanish aspell 6.0.2 that you put before.
Reply With Quote
  #15 (permalink)  
Old 10-30-2009, 02:00 AM
Junior Member
 
Posts: 5
Default

Doesn't work this solution. I have Release 6.0.2_GA_1912.UBUNTU8 UBUNTU8 NETWORK edition.

What can I do?
Reply With Quote
  #16 (permalink)  
Old 11-03-2009, 05:12 AM
Active Member
 
Posts: 38
Default

My users couldn't use spell check yesterday. I applied the fix from the first page of this topic and it seems to be working now.

English - 6.0.2 NE on RHEL 5 64-bit.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.