use FindBin;
binmode STDOUT, ':utf8';
-use Gitalist::Util qw(to_utf8);
-
BEGIN {
CGI->compile();
}
chomp($GIT);
# absolute fs-path which will be prepended to the project path
- our $projectroot = "/pub/scm";
+ #our $projectroot = "/pub/scm";
# target of the home link on top of all pages
our $home_link = $my_uri || "/";
return @list && scalar(grep { $_->{'path'} eq $project } @list);
}
+# decode sequences of octets in utf8 into Perl's internal form,
+# which is utf-8 with utf8 flag set if needed. gitweb writes out
+# in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
+sub to_utf8 {
+ my $str = shift;
+ if (utf8::valid($str)) {
+ utf8::decode($str);
+ return $str;
+ } else {
+ return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
+ }
+}
+
## ----------------------------------------------------------------------
## HTML aware string manipulation