Jump to content

darrenc

Members
  • Posts

    46
  • Joined

  • Last visited

Community Answers

  1. darrenc's post in undesirable: two typed spaces become space+  was marked as the answer   
    class TextformatterNBSPstripper extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'Unicode nbsp Stripper', 'version' => 100, 'summary' => "Replaces the Unicode non-breaking space character with a regular space. This prevents browser rendering of multiple consecutive spaces within text content.", ); } public function format(&$str) { if( !preg_match('/\x{00A0}/u', $str) ) return; $str = trim( preg_replace('/\x{00A0}/u', " ", $str) ); } } The above is the module I made. Obviously very basic but this is all new to me so hopefully I did it right. Happy to hear any pointers. I think I'll give it some testing and then submit a module addition on the off chance anyone else wants something similar.
×
×
  • Create New...