git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Best way to use gitweb with a non-utf8 git repository

From
RGRomano Giannetti <romano@dea.icai.upcomillas.es>
Date
Dec 19, 2005, 13:55 UTC
Message-ID
<20051219135514.GA22388@pern.dea.icai.upcomillas.es>
Hi,
    I am trying to start using git for a little project I have here. I
    stumbled with a small difficulty with gitweb. 
    For historical reasons the 3 or 4 files in my project that are not ascii
    or binary blobs are encoded in iso-8859-1. I know that utf8 is better,
    but I cannot do anything to enforce it... Well, git obviously has no
    problem, "all-is-a-byte-stream" is a great thing. The only problem is in
    "tree" view of gitweb, were the files with iso-8859-1 are filled with
    "invalid unicode sequence" symbols. I horribly hacked gitweb like this: 

--- /home/romano/software/downloads/gitweb.cgi 2005-12-16 12:10:46.000000000 +0100 +++ /var/www/cgi-bin/gitweb.cgi 2005-12-19 12:20:25.000000000 +0100

@@ -221,6 +221,7 @@
 # replace invalid utf8 character with SUBSTITUTION sequence
 sub esc_html {
        my $str = shift;
+       Encode::from_to($str, "iso-8859-1", "utf8");
        $str = decode("utf8", $str, Encode::FB_DEFAULT);
        $str = escapeHTML($str);
        return $str;

     but I wonder, is there a way to say gitweb "if invalid utf-8 is found,
     assume whatever-encoding-is encoding"? 

     Thanks,
            Romano      
        
-- 
Romano Giannetti             -  Univ. Pontificia Comillas (Madrid, Spain)
Electronic Engineer - phone +34 915 422 800 ext 2416  fax +34 915 596 569
http://www.dea.icai.upcomillas.es/romano/
Message 1 of 1 in “Best way to use gitweb with a non-utf8 git repository”
  1. Romano GiannettiDec 19, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.