Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

GPG appears to support Unicode, but I can't get it to actually work

% gpg --utf8-strings --display-charset utf-8 --edit-key king@example.com
gpg (GnuPG) 1.4.15; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: key xxxxxxxx: duplicated user ID detected - merged
Secret key is available.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: SC
                     trust: ultimate      validity: ultimate
sub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: E
[ultimate] (1). King George \xe2\xa3\x20<king@example.com>

gpg> uid

pub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: SC
                     trust: ultimate      validity: ultimate
sub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: E
[ultimate] (1). King George \xe2\xa3\x20<king@example.com>

gpg> adduid
Real name: King George Ⅳ      ### I type this.
Email address: king@example.com
Comment:
You are using the `utf-8' character set.
You selected this USER-ID:
    "King George � <king@example.com>"    ### Terminal notes corruption.

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

You need a passphrase to unlock the secret key for
user: "King George \xe2\xa3\x20<king@example.com>"
4096-bit RSA key, ID xxxxxxxx, created 2014-02-20


pub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: SC
                     trust: ultimate      validity: ultimate
sub  4096R/xxxxxxxx  created: 2014-02-20  expires: never       usage: E
[ultimate] (1)  King George \xe2\xa3\x20<king@example.com>
[ultimate] (2). King George \xe2\xa3\x20<king@example.com>  ### That's not correct UTF-8.
  • My terminal is set to use UTF-8.
  • LANG=en_US.UTF-8

Note the bottom: The UTF-8 sequence isn't correct, but it's close! The middle octet of the three-byte sequence that should be there is missing. I doubt there's anything I could do to cause the middle octet to drop, so what's going on here?

share|improve this question
    
Which unicode character(s) were you trying to add? I'll test it a little ... –  Ben Sep 21 at 19:27
    
@Ben: It's in the question, on the line with ### I type this.: "Ⅳ" — ROMAN NUMERAL FOUR, U+2163. –  Thanatos Sep 26 at 7:14
    
Okay, which version of the Unicode standard does your system support and does it support that full specification in all interfaces? BTW, the answer to the second part is almost certainly no, but I'd rather not assume that. –  Ben Sep 27 at 1:24
    
BTW, my guess is that the interface and/or font used to interact with GPG on the command line doesn't support that character, even though other parts of the system do (the same thing occurred when I tried here). –  Ben Sep 27 at 1:36
    
@Ben The "interface and/or font used to interact with GPG on the command line" is the terminal; I forget whether it was iTerm2 on OS X or gnome-terminal in Linux, but both have excellent Unicode support, and both have fonts. The encoding of the input is determined by the terminal application (and is by default UTF-8 just about everywhere); this in communicated to the application via the LANG environment variable, also correctly set. I need to answer this, as this turned out to be a bug in GnuPG. (IIRC, gpg2 works just fine. gpg does not.) –  Thanatos Oct 6 at 21:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.