Fix one of the segfaults on Ubuntu 9.10: determining text utf8 status.
Patch by allen.
diffs (31 lines):
diff -r d7d294f7f0af -r 9feb8d8019d5 cgi-bin/ljtextutil.pl
--- a/cgi-bin/ljtextutil.pl Sat Feb 13 01:11:46 2010 +0000
+++ b/cgi-bin/ljtextutil.pl Sat Feb 13 01:34:55 2010 +0000
@@ -276,8 +276,25 @@ sub is_utf8 {
*stab = *{"main::LJ::"};
undef $stab{is_utf8};
}
- *LJ::is_utf8 = \&Unicode::CheckUTF8::is_utf8;
- return Unicode::CheckUTF8::is_utf8($text);
+ *LJ::is_utf8 = \&LJ::is_utf8_wrapper;
+ return LJ::is_utf8_wrapper( $text );
+}
+
+# <LJFUNC>
+# name: LJ::is_utf8_wrapper
+# des: wraps the check for UTF-8 validity.
+# args: text
+# des-text: text to check for UTF-8 validity
+# returns: 1 if text is a valid UTF-8 stream, a reference, or null; 0
otherwise.
+# </LJFUNC>
+sub is_utf8_wrapper {
+ my $text = shift;
+
+ if ( defined $text && ! ref $text ) {
+ return Unicode::CheckUTF8::is_utf8( $text );
+ } else {
+ return 1;
+ }
}
# <LJFUNC>
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog