{"thread":{"id":"39114","subject":"What happen if show_http_message fails to reencode?","startedAt":"2015-04-20T06:29:41Z","lastAt":"2015-04-20T16:46:43Z","messageCount":2,"participants":["Yi, EungJun","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"259662","messageId":"CAFT+Tg9x3QfS4c93Bs_Oq0zc7bXvZdFZQAKJFPtqbp6M=Q-P0g@mail.gmail.com","threadId":"39114","inReplyTo":null,"subject":"What happen if show_http_message fails to reencode?","fromName":"Yi, EungJun","fromEmail":"semtlenori@gmail.com","sentAt":"2015-04-20T06:29:41Z","receivedAt":"2015-04-20T06:29:41Z","isPatch":false,"sender":{"key":"semtlenori@gmail.com","avatar":"https://gravatar.com/avatar/8363435d2badb3450df0dd7c4ec2113f6e1d62c44dd3cf7dfe83c5a389b8a9bf?d=mp&s=160"},"body":"I'm trying to make my git server sends http messages in non-ASCII\nencoding. And I have a question.\n\nAt 206-218 in remote-curl.c:\n\n> static int show_http_message(struct strbuf *type, struct strbuf *charset,\n>                  struct strbuf *msg)\n> {\n>     const char *p, *eol;\n>\n>     /*\n>      * We only show text/plain parts, as other types are likely\n>      * to be ugly to look at on the user's terminal.\n>      */\n>     if (strcmp(type->buf, \"text/plain\"))\n>         return -1;\n>     if (charset->len)\n>         strbuf_reencode(msg, charset->buf, get_log_output_encoding());\n\nWhat happen if the message has a character which cannot be encoded by\nthe encoding defined by i18n.logoutputencoding? Drops only the\ncharacter or brakes the whole message?\n\n-EungJun\n"},{"id":"259684","messageId":"xmqqk2x6n3ws.fsf@gitster.dls.corp.google.com","threadId":"39114","inReplyTo":"CAFT+Tg9x3QfS4c93Bs_Oq0zc7bXvZdFZQAKJFPtqbp6M=Q-P0g@mail.gmail.com","subject":"Re: What happen if show_http_message fails to reencode?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-04-20T16:46:43Z","receivedAt":"2015-04-20T16:46:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Yi, EungJun\" <semtlenori@gmail.com> writes:\n\n> I'm trying to make my git server sends http messages in non-ASCII\n> encoding. And I have a question.\n>\n> At 206-218 in remote-curl.c:\n>\n>> static int show_http_message(struct strbuf *type, struct strbuf *charset,\n>>                  struct strbuf *msg)\n>> {\n>>     const char *p, *eol;\n>>\n>>     /*\n>>      * We only show text/plain parts, as other types are likely\n>>      * to be ugly to look at on the user's terminal.\n>>      */\n>>     if (strcmp(type->buf, \"text/plain\"))\n>>         return -1;\n>>     if (charset->len)\n>>         strbuf_reencode(msg, charset->buf, get_log_output_encoding());\n>\n> What happen if the message has a character which cannot be encoded by\n> the encoding defined by i18n.logoutputencoding? Drops only the\n> character or brakes the whole message?\n\nI think the implementation of strbuf_reencode() should tell you\nquickly, but otherwise it may warrant a sentence or two of\ncommenting there.  It leaves the msg intact when underlying iconv()\nreports that it couldn't reencode, so you should get the original\nmessage literally.\n"}]}