{"thread":{"id":"2879","subject":"Best way to use gitweb with a non-utf8 git repository","startedAt":"2005-12-19T13:55:14Z","lastAt":"2005-12-19T13:55:14Z","messageCount":1,"participants":["Romano Giannetti"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13811","messageId":"20051219135514.GA22388@pern.dea.icai.upcomillas.es","threadId":"2879","inReplyTo":null,"subject":"Best way to use gitweb with a non-utf8 git repository","fromName":"Romano Giannetti","fromEmail":"romano@dea.icai.upcomillas.es","sentAt":"2005-12-19T13:55:14Z","receivedAt":"2005-12-19T13:55:14Z","isPatch":false,"sender":{"key":"romano@dea.icai.upcomillas.es","avatar":null},"body":"Hi,\n\n    I am trying to start using git for a little project I have here. I\n    stumbled with a small difficulty with gitweb. \n\n    For historical reasons the 3 or 4 files in my project that are not ascii\n    or binary blobs are encoded in iso-8859-1. I know that utf8 is better,\n    but I cannot do anything to enforce it... Well, git obviously has no\n    problem, \"all-is-a-byte-stream\" is a great thing. The only problem is in\n    \"tree\" view of gitweb, were the files with iso-8859-1 are filled with\n    \"invalid unicode sequence\" symbols. I horribly hacked gitweb like this: \n\n\n--- /home/romano/software/downloads/gitweb.cgi  2005-12-16 12:10:46.000000000 +0100\n+++ /var/www/cgi-bin/gitweb.cgi 2005-12-19 12:20:25.000000000 +0100\n@@ -221,6 +221,7 @@\n # replace invalid utf8 character with SUBSTITUTION sequence\n sub esc_html {\n        my $str = shift;\n+       Encode::from_to($str, \"iso-8859-1\", \"utf8\");\n        $str = decode(\"utf8\", $str, Encode::FB_DEFAULT);\n        $str = escapeHTML($str);\n        return $str;\n\n     but I wonder, is there a way to say gitweb \"if invalid utf-8 is found,\n     assume whatever-encoding-is encoding\"? \n\n     Thanks,\n            Romano      \n        \n-- \nRomano Giannetti             -  Univ. Pontificia Comillas (Madrid, Spain)\nElectronic Engineer - phone +34 915 422 800 ext 2416  fax +34 915 596 569\nhttp://www.dea.icai.upcomillas.es/romano/\n"}]}