Lowercase the tags, even when they contain non-unicode characters.
Note: Will not affect the display of older tags, until the entry they're on is
edited.
Patch by kareila.
diffs (37 lines):
diff -r 7bf1aafc3576 -r de76dd13ff5c cgi-bin/LJ/Tags.pm
--- a/cgi-bin/LJ/Tags.pm Mon Jun 14 23:58:29 2010 +0800
+++ b/cgi-bin/LJ/Tags.pm Tue Jun 15 00:11:38 2010 +0800
@@ -640,8 +640,7 @@ sub is_valid_tagstring {
$tag = LJ::trim($tag);
$tag =~ s/\s+/ /g; # condense multiple spaces to a single space
$tag = LJ::text_trim($tag, LJ::BMAX_KEYWORD, LJ::CMAX_KEYWORD);
- $tag = lc $tag
- if $tag !~ /[\x7f-\xff]/;
+ $tag = LJ::utf8_lc( $tag );
return $tag;
};
diff -r 7bf1aafc3576 -r de76dd13ff5c cgi-bin/ljtextutil.pl
--- a/cgi-bin/ljtextutil.pl Mon Jun 14 23:58:29 2010 +0800
+++ b/cgi-bin/ljtextutil.pl Tue Jun 15 00:11:38 2010 +0800
@@ -297,6 +297,20 @@ sub is_utf8_wrapper {
}
}
+
+# alternate version of "lc" that handles UTF-8
+# args: text string for lowercasing
+# returns: lowercase string
+sub utf8_lc {
+ use Encode; # Perl 5.8 or higher
+
+ # get the encoded text to work with
+ my $text = decode( "UTF-8", $_[0] );
+ # return the lowercased text
+ return encode( "UTF-8", lc $text );
+}
+
+
# <LJFUNC>
# name: LJ::text_out
# des: force outgoing text into valid UTF-8.
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog