Page MenuHome GnuPG

--list-keys with --with-colons suboption don`t reacts with --charset option
Closed, ResolvedPublic

Description

If used --with-colons option gpg always display keys text fields using utf-8
encoding and don't reacts on --charset option. Also some chars are convert to
\xXX format... so this text is difficult to use.
As I descover in this mode text fields are display by "print_string" function
but not "print_utf8_string". If change this behavior the problem goes.
I add quick-patch for with, but check for number of colons(":") need.

Details

Version
1.4.6

Event Timeline

Using utf-8 here is a feature and not a bug.
In aftersigned we might have better used percent style excaping instead of
C-style, but we can't change it. Some escaping is obviously needed.

Why? Why not to use --charset to set encoding? Why escaping is needed if this
mode (with-colons) is not appointed to diplay( isn't it?) but to get keys
information to applications?

Because --with-colons is not for humans. The specification says that the output
is utf-8. Haveing this variable would add an additional burden to each consumer
of --with-colons output to convert it.

Any structured data format needs some kind of quoting to distingusih content
from markup. Think of colons or linefeeds in user names.

Because --with-colons is not for humans.
The specification says that the output is utf-8.
Haveing this variable would add an additional burden
to each consumer of --with-colons output to convert it.

Ok. I see.

Any structured data format needs some kind of quoting to
distingusih content from markup. Think of colons or linefeeds
in user names.

Are hex-codes \x98, x9f, \x92 "special"? Why they must be escaped?

Latin-1 defines those as application specific. Some terminals actually use them
as control characters. Thus when filtering any output to do no harm it is
better to escape them too.

A decoder is required anyway and thusit doesn't matter whether they are escaped
or not. Yes it could be opmitimized, but why make things more complicated for no
good reason.

Ok. Thanks for your attention and patience.

werner claimed this task.