diff -Naur dictd-1.9.11/dictl.in dictd-1.9.11.fix/dictl.in --- dictd-1.9.11/dictl.in 2003-10-26 14:04:55 +0100 +++ dictl.in 2004-01-29 10:51:07 +0100 @@ -48,7 +48,7 @@ ##################################### -params="dict" +params="dict -n" while test $# -ne 0; do case $1 in --- /home/lav/RPM/BUILD/dictd-1.9.15/configure.in 2004-12-23 21:56:44 +0300 +++ configure.in 2006-03-13 00:09:30 +0300 @@ -320,6 +320,9 @@ fi fi +# Checks for libnatspec +AM_PATH_NATSPEC + AC_CHECK_LIB(Judy, JudySLNext, [JUDYLIB=-lJudy]) AC_CHECK_LIB(dbi, dbi_shutdown, [DBILIB=-ldbi]) --- /home/lav/RPM/BUILD/dictd-1.9.15/Makefile.in 2004-12-13 22:12:55 +0300 +++ Makefile.in 2006-03-13 00:13:35 +0300 @@ -81,7 +81,7 @@ LDFLAGS= @LDFLAGS@ XTRACFLAGS= @WCFLAGS@ @XTRACFLAGS@ @DEFS@ @CPPFLAGS@ -I. XTRALDFLAGS= @WLDFLAGS@ @XTRALDFLAGS@ -LDLIBS= @LIBS@ +LDLIBS= @LIBS@ @NATSPEC_LIBS@ LIBOBJS= @LIBOBJS@ LIBSOBJS= $(LIBOBJS:.o=.os) EXES= dict dictd dictzip dictfmt --- /home/lav/RPM/BUILD/dictd-1.9.15/dict.c 2004-11-17 15:39:44 +0300 +++ dict.c 2006-03-13 00:24:29 +0300 @@ -25,6 +25,10 @@ #include "parse.h" #include "md5.h" #include +#include +#ifdef HAVE_NATSPEC +#include +#endif extern int yy_flex_debug; lst_List dict_Servers; @@ -98,6 +102,8 @@ #define EXST_INVALID_STRATEGY 40 #define EXST_CONNECTION_FAILED 41 +char *localcharset = ""; + struct def { lst_List data; const char *word; @@ -266,6 +272,8 @@ lst_List l = lst_create(); char line[BUFFERSIZE]; int len; + char *source; + while ((len = net_read(s, line, BUFFERSIZE - 1)) >= 0) { line [len] = 0; @@ -273,10 +281,10 @@ client_bytes += len; PRINTF(DBG_RAW,("* Text: %s\n",line)); if (line[0] == '.' && line[1] == '\0') break; + source = line; if (len >= 2 && line[0] == '.' && line[1] == '.') - lst_append( l, xstrdup(line + 1) ); - else - lst_append( l, xstrdup(line) ); + source++; + lst_append( l, natspec_convert(source, localcharset, "UTF-8", 3)); } if (len < 0) { client_close_pager(); @@ -685,12 +693,15 @@ cmd_reply.key = c->key; } if ((len = strlen(buffer))) { - char *pt; + char *pt, *decodedline; PRINTF(DBG_PIPE,("* Sending %d commands (%d bytes)\n",count,len)); PRINTF(DBG_RAW,("* Send/%d: %s",c->command,buffer)); - pt = alloca(2*len); - client_crlf(pt,buffer); + + decodedline = natspec_convert(buffer, "UTF-8", localcharset, 3); + pt = alloca(2*strlen(decodedline)); + client_crlf(pt, decodedline); + free(decodedline); net_write( cmd_reply.s, pt, strlen(pt) ); } else { PRINTF(DBG_PIPE,("* Sending nothing\n")); @@ -1161,6 +1172,7 @@ "-s --strategy strategy for matching or defining", "-c --config specify configuration file", "-C --nocorrect disable attempted spelling correction", + "-n --notranslate disable UTF-8 -> client encoding translation", "-D --dbs show available databases", "-S --strats show available search strategies", "-H --serverhelp show server help", @@ -1217,6 +1229,7 @@ { "match", 0, 0, 'm' }, { "strategy", 1, 0, 's' }, { "nocorrect", 0, 0, 'C' }, + { "notranslate",0, 0, 'n' }, { "config", 1, 0, 'c' }, { "dbs", 0, 0, 'D' }, { "strats", 0, 0, 'S' }, @@ -1236,6 +1249,8 @@ { 0, 0, 0, 0 } }; + setlocale(LC_CTYPE, ""); + dict_output = stdout; maa_init(argv[0]); @@ -1249,7 +1264,7 @@ dbg_register( DBG_URL, "url" ); while ((c = getopt_long( argc, argv, - "h:p:d:i:Ims:DSHau:c:Ck:VLvrP:", + "h:p:d:i:Imns:DSHau:c:Ck:VLvrP:", longopts, NULL )) != EOF) { switch (c) { @@ -1259,6 +1274,7 @@ case 'i': database = optarg; function |= INFO; break; case 'I': function |= SERVER; break; case 'm': function = MATCH; break; + case 'n': localcharset = "UTF-8"; break; case 's': strategy = optarg; break; case 'D': function |= DBS; break; case 'S': function |= STRATS; break;