Ignore:
Timestamp:
04/30/06 09:46:23 (9 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.

File:
1 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  { 
Note: See TracChangeset for help on using the changeset viewer.