Subject: Gitweb error: XML Parsing Error: not well-formed

From: "Juan J. Martinez" <[email-masked]>
Date: Fri, 20 Feb 2015 15:17:55 +0000

Hi,

I'm experiencing a problem with gitweb and some utf-8 bits like £ (the
pound sign) when showing diffs.

Example (Firefox's output):

XML Parsing Error: not well-formed Location:
https://hostname/gitweb?p=redacted.git;a=commitdiff;h=16ae27d6b030949772b298c6e2935a09c48169a7
Line Number 913, Column 492:<div class="diff chunk_header"><span
class="chunk_info">@@ <a class="list"
href="/gitweb?p=redacted.git;a=blob;f=redacted/redacted.py;h=ce79b086288b96e6dd25d0f0bfb5b5018cca6fe0#l1043">-1043,7</a>
<a class="list"
href="/gitweb?p=redacted.git;a=blob;f=redacted/redacted.py;h=774c74b703a7d211fe19433236d1745ac7d7697c;hb=16ae27d6b030949772b298c6e2935a09c48169a7#l1044">+1044,7</a>
@@</span><span
class="section">&nbsp;outstanding&nbsp;amount&nbsp;is&nbsp;10.00.</span></div>

That should be "£10.00".

This is with latest gitweb  code
(sha:f3f407747c1cce420ae4b4857c4a6806efe38680) and perl v5.10.1.

The problem seems to be in gitweb.perl around line 1543.

Looks like utf8::is_utf8 returns false, and the conversion "in place"
with utf8::decode doesn't seem to work (although it returns success,
Firefox doesn't like it).

As a workaround I removed the "|| utf8::decode($str)" on the condition
and the error is gone, although I'm not sure about the consequences of
doing that (I guess it returns part of the content in the fallback
encoding; latin1 in this case).

Regards,

Juan

-- 
Juan J. Martinez
Development Manager, MEMSET

mail: [email-masked]
 web: http://www.memset.com/

Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey GU6 8TB, UK.