X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FCurrentUser.pm;h=99a0641e5e742cb5abf10ee0132c2844a9db532a;hb=73a6a80a9ca5edbd43d139b7cb25bfee4abfd35e;hp=7d24779bf5726fbe45068251ca46eb80f203dcc6;hpb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;p=freeside.git diff --git a/rt/lib/RT/CurrentUser.pm b/rt/lib/RT/CurrentUser.pm index 7d24779bf..99a0641e5 100755 --- a/rt/lib/RT/CurrentUser.pm +++ b/rt/lib/RT/CurrentUser.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -54,7 +54,7 @@ use RT::CurrentUser; - # laod + # load my $current_user = RT::CurrentUser->new; $current_user->Load(...); # or @@ -240,9 +240,12 @@ sub loc { my $handle = $self->LanguageHandle; if (@_ == 1) { - # pre-scan the lexicon hashes to return _AUTO keys verbatim, - # to keep locstrings containing '[' and '~' from tripping over Maketext - return $_[0] unless grep exists $_->{$_[0]}, @{ $handle->_lex_refs }; + # If we have no [_1] replacements, and the key does not appear + # in the lexicon, unescape (using ~) and return it verbatim, as + # an optimization. + my $unescaped = $_[0]; + $unescaped =~ s!~(.)!$1!g; + return $unescaped unless grep exists $_->{$_[0]}, @{ $handle->_lex_refs }; } return $handle->maketext(@_); @@ -252,9 +255,6 @@ sub loc_fuzzy { my $self = shift; return '' if !defined $_[0] || $_[0] eq ''; - # XXX: work around perl's deficiency when matching utf8 data - return $_[0] if Encode::is_utf8($_[0]); - return $self->LanguageHandle->maketext_fuzzy( @_ ); }