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

From: Romano Giannetti <hidden>
Date: 2016-06-15 22:42:15

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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help