Changeset 498


Ignore:
Timestamp:
04/30/06 09:46:23 (13 years ago)
Author:
gogo
Message:

Add config value SpellChecker?.utf8_to_entities which can be set to
false to stop SpellChecker? from converting (multi byte) utf8
characters to entities before passing to aspell - ticket:120
indicates this is not required. Config value is true by default for
backwards compatability.

Location:
trunk/plugins/SpellChecker
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SpellChecker/spell-check-logic.php

    r418 r498  
    33 
    44  // Convert UTF-8 multi-bytes into decimal character entities.  This is because 
    5   // aspell isn't fully utf8-aware 
    6   $text = preg_replace('/([\xC0-\xDF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); 
    7   $text = preg_replace('/([\xE0-\xEF][\x80-\xBF][\x80-\xBF])/e',             "'&#' . utf8_ord('\$1') . ';'",  $text); 
    8   $text = preg_replace('/([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'",   $text); 
    9  
     5  // aspell isn't fully utf8-aware - ticket:120 raises the possibility  
     6  // that this is not required (any more) and so you can turn it off 
     7  // with editor.config.SpellChecker.utf8_to_entities = false  
     8  if(!isset($_REQUEST['utf8_to_entitis']) || $_REQUEST['utf8_to_entities']) 
     9  { 
     10    $text = preg_replace('/([\xC0-\xDF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); 
     11    $text = preg_replace('/([\xE0-\xEF][\x80-\xBF][\x80-\xBF])/e',             "'&#' . utf8_ord('\$1') . ';'",  $text); 
     12    $text = preg_replace('/([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'",   $text); 
     13  } 
     14   
    1015  function utf8_ord($chr) 
    1116  { 
  • trunk/plugins/SpellChecker/spell-check-ui.html

    r415 r498  
    6363          /><input type="hidden" name="dictionary" id="f_dictionary" 
    6464          /><input type="hidden" name="init" id="f_init" value="1" 
     65          /><input type="hidden" name="utf8_to_entities" id="utf8_to_entities" value="1" 
    6566    /></form> 
    6667 
  • trunk/plugins/SpellChecker/spell-check-ui.js

    r419 r498  
    216216    field.form.action = _editor_url + '/plugins/SpellChecker/spell-check-logic.php'; 
    217217  } 
    218  
     218  if(editor.config.SpellChecker.utf8_to_entities) 
     219  { 
     220    document.getElementById('utf8_to_entities').value = 1; 
     221  } 
     222  else 
     223  { 
     224    document.getElementById('utf8_to_entities').value = 0; 
     225  } 
    219226  field.form.submit(); 
    220227  document.getElementById("f_init").value = "0"; 
  • trunk/plugins/SpellChecker/spell-checker.js

    r419 r498  
    99// $Id$ 
    1010 
    11 HTMLArea.Config.prototype.SpellChecker = { 'backend': 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_GB' }; 
     11HTMLArea.Config.prototype.SpellChecker = { 'backend': 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_GB', 'utf8_to_entities' : true }; 
    1212 
    1313function SpellChecker(editor) { 
Note: See TracChangeset for help on using the changeset viewer.