]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Convert project name to UTF-8
authorYasushi SHOJI <redacted>
Tue, 30 Jan 2007 10:23:38 +0000 (19:23 +0900)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
If the repository directory name is in non-ascii, $project needs to be
converted from perl internal to utf-8 because it will be used as
title, page path, and snapshot filename.

use to_utf8() to do the conversion.

Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 3fd8afd92b43217988eac80e368002453854a6b132325ffeb6f89dfefd19441c..e473e8ec81d9a80787aef86c31f957eb8a4832546081759a8eb78c7bc332f162 100755 (executable)
@@ -1691,7 +1691,7 @@ sub git_header_html {
 
        my $title = "$site_name";
        if (defined $project) {
-               $title .= " - $project";
+               $title .= " - " . to_utf8($project);
                if (defined $action) {
                        $title .= "/$action";
                        if (defined $file_name) {
@@ -1964,7 +1964,7 @@ sub git_print_page_path {
 
        print "<div class=\"page_path\">";
        print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
-                     -title => 'tree root'}, "[$project]");
+                     -title => 'tree root'}, to_utf8("[$project]");
        print " / ";
        if (defined $name) {
                my @dirname = split '/', $name;
@@ -3611,7 +3611,7 @@ sub git_snapshot {
                $hash = git_get_head_hash($project);
        }
 
-       my $filename = basename($project) . "-$hash.tar.$suffix";
+       my $filename = to_utf8(basename($project)) . "-$hash.tar.$suffix";
 
        print $cgi->header(
                -type => "application/$ctype",
This page took 0.28722 seconds and 4 git commands to generate.