First of all, thanks to everybody for their replies.

In reply to

http://bugzilla.mkgnu.net/show_bug.cgi?id=580#c33


> > At this point, the comment still seems to be intact. The special
> > characters are there and the Branch and Affected files info is 
present,
> > nothing unusual.

> This is because the data is read in CP_850 form Windows, handled as
> CP_850 byte array internally by Perl and then printed again in CP_850
> to your file.

That sounds like a pretty good explanation

> > And if so, why would Bugzilla work while entering special characters 
via
> > the Web interface? As it does....

> Bugzilla converts on it's own, but I don't think this happens directly
> in the API, but whereever input is read from the browser etc.

You are probably right, a search for 'utf8' in the Bugzilla code base 
found
some 100 occurrences, by far most of them look like this:

if Bugzilla->params->{'utf8'}

Obviously, this call refers to the Bugzilla config parameter called 'utf8'
that can be set to true or false on the Administration page of Bugzilla.

> > Does anyone have a clue how to get this fixed or how to proceed in 
order
> > to track the error further down?

> I think the following is what you need, maybe on a different place on
> newer versions of SCMBug. I would just search for the statement in the
> comment. It should work if you encode before using add_comment, of
> course, but the first place where SCMBug gets the comment is the best.

> http://bugzilla.mkgnu.net/show_bug.cgi?id=580#c14

Yes - that did the job. That is, first I tried decoding and inserted

$request->{ original_log_message } = decode( "cp850", $request->{ 
$original_log_message } );

into Process.pm line 149 (this is the different place in v0.26.19).

That helped a bit: The comment was not truncated anymore. However, the 
umlauts
were replaced by other strange characters:

bla bla bl÷ funktionieren die umlaute jetzt? bli bla bl³

Then I tried decoding with subsequent encoding - same result.

Finally, I just encoded the comment in utf, without decoding it 
beforehand.

$request->{ original_log_message } = encode( "utf-8", $request->{ 
$original_log_message } );

Bingo - there was the comment in Bugzilla as I entered it in SVN!

After reconsidering a bit, I suggest the following fix:

In my opinion, this is an issue that is caused by Bugzilla expecting 
UTF-encoded strings.
It should not affect the use of other bug trackers with scmbug that 
possibly use other
encodings.

Therefore, I suggest fixing this in Bugzilla->integration_add_comment 
(somewhere around line 620):

    } else {
        # The bug id exists
        $dbh->bz_start_transaction();
        $bug->add_comment( $comment, {isprivate => 0, work_time => 0, type 
=> Bugzilla::Constants->CMT_NORMAL, extra_data => ""} );
        $bug->update();
        $dbh->bz_commit_transaction();
 
        return 0;
    }

This block could be changed to:

    } else {
        # The bug id exists
 
        # inserted by mk
        $comment = encode( "utf-8", $comment ) if Bugzilla->params->{ 
'utf8' };
 
        $dbh->bz_start_transaction();
        $bug->add_comment( $comment, {isprivate => 0, work_time => 0, type 
=> Bugzilla::Constants->CMT_NORMAL, extra_data => ""} );
        $bug->update();
        $dbh->bz_commit_transaction();
 
        return 0;
    }

This would only affect installations of scmbug with Bugzilla, and by 
directly requesting the Bugzilla config, 
it *should* work for any Bugzilla configuration.

Thanks again for your help on this one!


Mit freundlichen Grüßen/Kind regards

Markus Kling
Software Architect

Daimler TSS GmbH
Consulting
Wilhelm-Runge-Strasse 11
89081 Ulm/Germany 

Phone +49–(0)731 / 5 05-63 05
Mobile +49-(0)160 / 86 77 433
Fax +49–(0)711 / 30 52 18 01 79

mailto:[email protected]

http://www.daimler-tss.com

 

Daimler TSS GmbH
Sitz und Registergericht/Domicile and Register Court: Ulm, 
HRB-Nr./Commercial Register No.: 3844 
Geschäftsführung/Management: Gerhard Streit (Vorsitzender/Chairperson), 
Dr. Stefan Eberhardt
Beiratsvorsitzende/Chairperson of the Advisory Board: Dr. Helmut Mahler

If you are not the intended addressee, please inform us immediately that you 
have received this e-mail in error, and delete it. We thank you for your 
cooperation.  
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to