git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] Do attempt pretty print in ASCII-incompatible encodings

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Feb 21, 2012, 14:53 UTC
Message-ID
<CACsJy8C30mTFwduiSv_z458DgDBb0O=Jn19qMSwkAHuFadtBMg@mail.gmail.com>
In-Reply-To
<1329834292-2511-2-git-send-email-pclouds@gmail.com>
2012/2/21 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
Show 19 quoted lines
> @@ -482,3 +482,18 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
>        return out;
>  }
>  #endif
> +
> +int ascii_superset_encoding(const char *encoding)
> +{
> +       const char *sample = " !\"#$%&'()*+,-./0123456789:;<=>?@"
> +               "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
> +               "abcdefghijklmnopqrstuvwxyz{|}~\n";
> +       char *output;
> +       int ret;
> +       if (!encoding)
> +               return 1;
> +       output = reencode_string(sample, encoding, "US-ASCII");
> +       ret = !output || !strcmp(sample, output);
> +       free(output);
> +       return ret;
> +}

Side note about this function, which was written to ban all ascii-incompatible charsets from entering commit objects. The idea of mixing charsets in the same buffer without clear boundary does not sound healthy. Plus, ident.c will silently drop '\n', '<' and '>' in author/committer. If a hypothetical charset happens to place a letter in those, um.. code points?, the letter will be dropped. But meh..

-- 
Duy
Previous: Nguyễn Thái Ngọc DuyNext: Jeff King
Message 3 of 12 in “t3900: add missing UTF-16.txt and mark the test successful”
  1. 1/4 t3900: add missing UTF-16.txt and mark the test successfulNguyễn Thái Ngọc Duy, Feb 21, 2012
  2. 2/4 Do attempt pretty print in ASCII-incompatible encodingsNguyễn Thái Ngọc Duy, Feb 21, 2012
  3. Nguyen Thai Ngoc DuyFeb 21, 2012
  4. Jeff KingFeb 21, 2012
  5. Nguyen Thai Ngoc DuyFeb 22, 2012
  6. Peter KreftingFeb 23, 2012
  7. 3/4 utf8: die if failed to re-encodingNguyễn Thái Ngọc Duy, Feb 21, 2012
  8. Junio C HamanoFeb 21, 2012
  9. 4/4 Only re-encode certain parts in commit object, not the wholeNguyễn Thái Ngọc Duy, Feb 21, 2012
  10. Jeff KingFeb 21, 2012
  11. Nguyen Thai Ngoc DuyFeb 22, 2012
  12. Junio C HamanoFeb 22, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.