From 081a9b6fb73b20940548b77744ef6fca4c9d85f1 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Thu, 19 Aug 2004 20:40:52 +0000 Subject: * hkp.c (hkp_search): Translate string to search for from utf8 to native before displaying it. * keyserver.c (keyserver_search_prompt): Comments. --- g10/ChangeLog | 7 +++++++ g10/hkp.c | 16 +++++++++------- g10/keyserver.c | 5 +++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 4a555893f..096e6ac2e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-08-19 David Shaw + + * hkp.c (hkp_search): Translate string to search for from utf8 to + native before displaying it. + + * keyserver.c (keyserver_search_prompt): Comments. + 2004-08-19 Werner Koch * seskey.c (encode_session_key): Changed the zero random byte diff --git a/g10/hkp.c b/g10/hkp.c index d62becff2..8c6a52549 100644 --- a/g10/hkp.c +++ b/g10/hkp.c @@ -1,5 +1,6 @@ /* hkp.c - Horowitz Keyserver Protocol - * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, + * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -486,11 +487,9 @@ int hkp_search(STRLIST tokens) { int rc=0,len=0,max,first=1; #ifndef __riscos__ - unsigned char *searchstr=NULL,*searchurl; - unsigned char *request; + unsigned char *searchstr=NULL,*searchstr_printable,*searchurl,*request; #else - char *searchstr=NULL,*searchurl; - char *request; + char *searchstr=NULL,*searchstr_printable,*searchurl,*request; #endif struct http_context hd; unsigned int hflags=opt.keyserver_options.honor_http_proxy?HTTP_FLAG_TRY_PROXY:0; @@ -520,8 +519,10 @@ int hkp_search(STRLIST tokens) searchstr[len-1]='\0'; + searchstr_printable=utf8_to_native(searchstr,len-1,0); + log_info(_("searching for \"%s\" from HKP server %s\n"), - searchstr,opt.keyserver_host); + searchstr_printable,opt.keyserver_host); /* Now make it url-ish */ @@ -616,7 +617,7 @@ int hkp_search(STRLIST tokens) count--; if(ret>-1) - keyserver_search_prompt(buffer,count,searchstr); + keyserver_search_prompt(buffer,count,searchstr_printable); iobuf_close(buffer); m_free(line); @@ -625,6 +626,7 @@ int hkp_search(STRLIST tokens) m_free(request); m_free(searchurl); m_free(searchstr); + m_free(searchstr_printable); return rc; } diff --git a/g10/keyserver.c b/g10/keyserver.c index 47e386424..6170fc96a 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -1,5 +1,5 @@ /* keyserver.c - generic keyserver code - * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1020,7 +1020,8 @@ keyserver_search(STRLIST tokens) /* Count and searchstr are just for cosmetics. If the count is too small, it will grow safely. If negative it disables the "Key x-y - of z" messages. */ + of z" messages. searchstr should be native (rather than utf8) + encoding since we're going to printf it. */ /* TODO: do this as a list sent to keyserver_work rather than calling it once for each key to get the correct counts after the import -- cgit v1.2.3