public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/4] gdb/python: handle non utf-8 characters when source highlighting
Date: Mon, 10 Jan 2022 10:32:02 -0500	[thread overview]
Message-ID: <09a27370-a759-1f81-9db6-38ad2fd97ccd@polymtl.ca> (raw)
In-Reply-To: <20220110104102.GQ828155@redhat.com>

> Unfortunately it's not as simple as bytes in bytes out.  See:
> 
>   https://pygments.org/docs/unicode/?highlight=encoding
> 
> In summary, Pygments uses unicode internally, but has some logic for
> guessing the encoding of the incoming bytes.  This logic is better (I
> claim) than GDB's hard-coded use UTF-8.  The link above outlines how
> the guess is done in more detail.
> 
> Pygments always returns a unicode object, which is one of the reasons
> I have GDB handle both bytes and unicode being returned from the
> colorize API.  We could always make the API for restricted, and insist
> on a bytes object being returned, this would just require us to
> convert the output of Pygments to bytes before returning to GDB.

Ok, so when does "colorize" returns bytes?

Simon

  reply	other threads:[~2022-01-10 15:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 14:23 [PATCH 0/4] Source highlight non utf-8 characters using Python Andrew Burgess
2022-01-07 14:23 ` [PATCH 1/4] gdb: new 'maint flush source-cache' command Andrew Burgess
2022-01-07 14:49   ` Eli Zaretskii
2022-01-11 12:13     ` Andrew Burgess
2022-01-11 13:31       ` Eli Zaretskii
2022-01-12 11:38         ` Andrew Burgess
2022-01-10 15:18   ` Tom Tromey
2022-01-07 14:23 ` [PATCH 2/4] gdb: erase items from the source_cache::m_offset_cache Andrew Burgess
2022-01-10 15:24   ` Tom Tromey
2022-01-11 12:17     ` Andrew Burgess
2022-01-11 14:54       ` Tom Tromey
2022-01-12 11:38         ` Andrew Burgess
2022-01-07 14:23 ` [PATCH 3/4] gdb: add 'maint set/show gnu-source-highlight enabled' command Andrew Burgess
2022-01-07 14:53   ` Eli Zaretskii
2022-01-11 13:07     ` Andrew Burgess
2022-01-11 13:34       ` Eli Zaretskii
2022-01-12 11:37         ` Andrew Burgess
2022-01-10 15:58   ` Tom Tromey
2022-01-07 14:23 ` [PATCH 4/4] gdb/python: handle non utf-8 characters when source highlighting Andrew Burgess
2022-01-10  3:27   ` Simon Marchi
2022-01-10 10:41     ` Andrew Burgess
2022-01-10 15:32       ` Simon Marchi [this message]
2022-01-11 13:10         ` Andrew Burgess
2022-01-11 19:24   ` Tom Tromey
2022-01-11 19:42     ` Patrick Monnerat
2022-01-12 14:30 ` [PATCHv2 0/2] Source highlight non utf-8 characters using Python Andrew Burgess
2022-01-12 14:30   ` [PATCHv2 1/2] gdb/python: add gdb.host_charset function Andrew Burgess
2022-01-12 15:02     ` Eli Zaretskii
2022-01-12 15:23     ` Tom Tromey
2022-01-12 16:05     ` Andrew Burgess
2022-01-12 14:30   ` [PATCHv2 2/2] gdb/python: handle non utf-8 characters when source highlighting Andrew Burgess
2022-01-12 15:32     ` Tom Tromey
2022-01-12 15:59       ` Andrew Burgess
2022-01-19 17:44         ` Andrew Burgess
2022-01-21 16:59         ` Simon Marchi
2022-01-26 23:13           ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09a27370-a759-1f81-9db6-38ad2fd97ccd@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).