Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
gitweb: refactor decode() for utf8 conversion
author
Yasushi SHOJI
<yashi@atmark-techno.com>
Sun, 1 Oct 2006 21:21:33 +0000
(06:21 +0900)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 6 Oct 2006 09:56:50 +0000
(
02:56
-0700)
we already had a few place using decode() to convert perl internal
encode to utf8. added a new thin wrapper to do just that.
Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3df1967
)
diff --git
a/gitweb/gitweb.perl
b/gitweb/gitweb.perl
index 3320069171dbd8ed20b89f2d60a9e5ccdf1958f2..3cc0e965fceb8ca8ace84feb172ba4872b35d1e1 100755
(executable)
--- a/
gitweb/gitweb.perl
+++ b/
gitweb/gitweb.perl
@@
-443,6
+443,12
@@
sub validate_refname {
return $input;
}
return $input;
}
+# very thin wrapper for decode("utf8", $str, Encode::FB_DEFAULT);
+sub to_utf8 {
+ my $str = shift;
+ return decode("utf8", $str, Encode::FB_DEFAULT);
+}
+
# quote unsafe chars, but keep the slash, even when it's not
# correct, but quoted slashes look too horrible in bookmarks
sub esc_param {
# quote unsafe chars, but keep the slash, even when it's not
# correct, but quoted slashes look too horrible in bookmarks
sub esc_param {
@@
-465,7
+471,7
@@
sub esc_url {
# replace invalid utf8 character with SUBSTITUTION sequence
sub esc_html {
my $str = shift;
# replace invalid utf8 character with SUBSTITUTION sequence
sub esc_html {
my $str = shift;
- $str =
decode("utf8", $str, Encode::FB_DEFAULT
);
+ $str =
to_utf8($str
);
$str = escapeHTML($str);
$str =~ s/\014/^L/g; # escape FORM FEED (FF) character (e.g. in COPYING file)
$str =~ s/\033/^[/g; # "escape" ESCAPE (\e) character (e.g. commit 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1)
$str = escapeHTML($str);
$str =~ s/\014/^L/g; # escape FORM FEED (FF) character (e.g. in COPYING file)
$str =~ s/\033/^[/g; # "escape" ESCAPE (\e) character (e.g. commit 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1)
@@
-668,7
+674,7
@@
sub format_subject_html {
if (length($short) < length($long)) {
return $cgi->a({-href => $href, -class => "list subject",
if (length($short) < length($long)) {
return $cgi->a({-href => $href, -class => "list subject",
- -title =>
decode("utf8", $long, Encode::FB_DEFAULT
)},
+ -title =>
to_utf8($long
)},
esc_html($short) . $extra);
} else {
return $cgi->a({-href => $href, -class => "list subject"},
esc_html($short) . $extra);
} else {
return $cgi->a({-href => $href, -class => "list subject"},
@@
-845,7
+851,7
@@
sub git_get_projects_list {
-e "$projectroot/$path/$export_ok")) {
my $pr = {
path => $path,
-e "$projectroot/$path/$export_ok")) {
my $pr = {
path => $path,
- owner =>
decode("utf8", $owner, Encode::FB_DEFAULT
),
+ owner =>
to_utf8($owner
),
};
push @list, $pr
}
};
push @list, $pr
}
@@
-874,7
+880,7
@@
sub git_get_project_owner {
$pr = unescape($pr);
$ow = unescape($ow);
if ($pr eq $project) {
$pr = unescape($pr);
$ow = unescape($ow);
if ($pr eq $project) {
- $owner =
decode("utf8", $ow, Encode::FB_DEFAULT
);
+ $owner =
to_utf8($ow
);
last;
}
}
last;
}
}
@@
-1236,7
+1242,7
@@
sub get_file_owner {
}
my $owner = $gcos;
$owner =~ s/[,;].*$//;
}
my $owner = $gcos;
$owner =~ s/[,;].*$//;
- return
decode("utf8", $owner, Encode::FB_DEFAULT
);
+ return
to_utf8($owner
);
}
## ......................................................................
}
## ......................................................................
@@
-3589,7
+3595,7
@@
sub git_rss {
"<![CDATA[\n";
my $comment = $co{'comment'};
foreach my $line (@$comment) {
"<![CDATA[\n";
my $comment = $co{'comment'};
foreach my $line (@$comment) {
- $line =
decode("utf8", $line, Encode::FB_DEFAULT
);
+ $line =
to_utf8($line
);
print "$line<br/>\n";
}
print "<br/>\n";
print "$line<br/>\n";
}
print "<br/>\n";
@@
-3598,7
+3604,7
@@
sub git_rss {
next;
}
my $file = esc_html(unquote($7));
next;
}
my $file = esc_html(unquote($7));
- $file =
decode("utf8", $file, Encode::FB_DEFAULT
);
+ $file =
to_utf8($file
);
print "$file<br/>\n";
}
print "]]>\n" .
print "$file<br/>\n";
}
print "]]>\n" .