All of lore.kernel.org
 help / color / mirror / Atom feed
* What happen if show_http_message fails to reencode?
@ 2015-04-20  6:29 Yi, EungJun
  2015-04-20 16:46 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Yi, EungJun @ 2015-04-20  6:29 UTC (permalink / raw)
  To: Git List

I'm trying to make my git server sends http messages in non-ASCII
encoding. And I have a question.

At 206-218 in remote-curl.c:

> static int show_http_message(struct strbuf *type, struct strbuf *charset,
>                  struct strbuf *msg)
> {
>     const char *p, *eol;
>
>     /*
>      * We only show text/plain parts, as other types are likely
>      * to be ugly to look at on the user's terminal.
>      */
>     if (strcmp(type->buf, "text/plain"))
>         return -1;
>     if (charset->len)
>         strbuf_reencode(msg, charset->buf, get_log_output_encoding());

What happen if the message has a character which cannot be encoded by
the encoding defined by i18n.logoutputencoding? Drops only the
character or brakes the whole message?

-EungJun

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What happen if show_http_message fails to reencode?
  2015-04-20  6:29 What happen if show_http_message fails to reencode? Yi, EungJun
@ 2015-04-20 16:46 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2015-04-20 16:46 UTC (permalink / raw)
  To: semtlenori; +Cc: Git List

"Yi, EungJun" <semtlenori@gmail.com> writes:

> I'm trying to make my git server sends http messages in non-ASCII
> encoding. And I have a question.
>
> At 206-218 in remote-curl.c:
>
>> static int show_http_message(struct strbuf *type, struct strbuf *charset,
>>                  struct strbuf *msg)
>> {
>>     const char *p, *eol;
>>
>>     /*
>>      * We only show text/plain parts, as other types are likely
>>      * to be ugly to look at on the user's terminal.
>>      */
>>     if (strcmp(type->buf, "text/plain"))
>>         return -1;
>>     if (charset->len)
>>         strbuf_reencode(msg, charset->buf, get_log_output_encoding());
>
> What happen if the message has a character which cannot be encoded by
> the encoding defined by i18n.logoutputencoding? Drops only the
> character or brakes the whole message?

I think the implementation of strbuf_reencode() should tell you
quickly, but otherwise it may warrant a sentence or two of
commenting there.  It leaves the msg intact when underlying iconv()
reports that it couldn't reencode, so you should get the original
message literally.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-20 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20  6:29 What happen if show_http_message fails to reencode? Yi, EungJun
2015-04-20 16:46 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.