[PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Erik Faye-Lund
Even though parse-options doesn't support UTF-8 switches (which makes sense; non-ascii switches would be difficult to enter on some keyboard layouts), it can be useful to report incorrectly entered UTF-8 switches to make the output somewhat less ugly for those of us with keyboard layouts with

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Matthieu Moy
Erik Faye-Lund kusmab...@gmail.com writes: --- a/parse-options.c +++ b/parse-options.c @@ -3,6 +3,7 @@ #include cache.h #include commit.h #include color.h +#include utf8.h static int parse_options_usage(struct parse_opt_ctx_t *ctx, const char * const

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Erik Faye-Lund
On Mon, Feb 11, 2013 at 2:43 PM, Matthieu Moy matthieu@grenoble-inp.fr wrote: Erik Faye-Lund kusmab...@gmail.com writes: --- a/parse-options.c +++ b/parse-options.c @@ -3,6 +3,7 @@ #include cache.h #include commit.h #include color.h +#include utf8.h static int

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Matthieu Moy
Erik Faye-Lund kusmab...@gmail.com writes: But isn't UTF-8 constructed to be very unlikely to clash with existing encodings? If so, I could add a case for non-ascii and non-UTF-8, that simply writes the byte as a hex-tuple? If it's non-ascii and non-UTF-8, I think you'd want to display the

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Torsten Bögershausen
On 11.02.13 14:34, Erik Faye-Lund wrote: Even though parse-options doesn't support UTF-8 switches (which makes sense; non-ascii switches would be difficult to enter on some keyboard layouts), it can be useful to report incorrectly entered UTF-8 switches to make the output somewhat less ugly

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Erik Faye-Lund
On Mon, Feb 11, 2013 at 5:28 PM, Torsten Bögershausen tbo...@web.de wrote: On 11.02.13 14:34, Erik Faye-Lund wrote: Even though parse-options doesn't support UTF-8 switches (which makes sense; non-ascii switches would be difficult to enter on some keyboard layouts), it can be useful to report

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Junio C Hamano
Erik Faye-Lund kusmab...@gmail.com writes: However, since git only looks at one byte at the time for short-options, it ends up reporting a partial UTF-8 sequence in such cases, leading to corruption of the output. Isn't it a workable, easier and more robust alternative to punt and use the

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Erik Faye-Lund
On Mon, Feb 11, 2013 at 6:07 PM, Junio C Hamano gits...@pobox.com wrote: Erik Faye-Lund kusmab...@gmail.com writes: However, since git only looks at one byte at the time for short-options, it ends up reporting a partial UTF-8 sequence in such cases, leading to corruption of the output.

Re: [PATH/RFC] parse-options: report invalid UTF-8 switches

2013-02-11 Thread Erik Faye-Lund
On Mon, Feb 11, 2013 at 6:19 PM, Jeff King p...@peff.net wrote: On Mon, Feb 11, 2013 at 09:07:53AM -0800, Junio C Hamano wrote: Erik Faye-Lund kusmab...@gmail.com writes: However, since git only looks at one byte at the time for short-options, it ends up reporting a partial UTF-8 sequence