? filter_utf8_fix.patch
Index: examples/filter_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/docs/developer/examples/filter_example.module,v
retrieving revision 1.8
diff -u -p -r1.8 filter_example.module
--- examples/filter_example.module 29 Jan 2007 16:19:57 -0000 1.8
+++ examples/filter_example.module 13 Jan 2008 19:14:31 -0000
@@ -125,15 +125,18 @@ function filter_example_filter($op, $del
// is to use the "prepare" operation to escape the special characters, and
// to later replace our escaped version in the "process" step.
//
- // We'll use the bytes 0xFE and 0xFF to replace < and > here. These bytes
- // are not valid in UTF-8 data and thus unlikely to cause problems.
+ // We'll use the unicode characters U+F8FF and U+F8FE (Private use
+ // characters) to replace < and > here. These characters are reserved
+ // by the Unicode standard for internal use in software.
+ // These characters are represented by the byte sequences \xEF\xA3\xBF and
+ // \xEF\xA3\xBE.
case 'prepare':
- return preg_replace('!!', '\xFEtime /\xFF', $text);
+ return preg_replace('!!', "\xEF\xA3\xBFtime /\xEF\xA3\xBE", $text);
// Now, in the "process" step, we'll search for our escaped time tags and
// to the real filtering.
case 'process':
- return str_replace('\xFEtime /\xFF', ''. format_date(time()) .'', $text);
+ return str_replace("\xEF\xA3\xBFtime /\xEF\xA3\xBE", ''. format_date(time()) .'', $text);
}
break;
}