ALT Linux Bugzilla
– Attachment 571 Details for
Bug 5054
Command line switches don't support current locale
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Позволяет вводить в командной строке non-Latin1 имена пользователей
rdesktop-1.3.1-rdp_out_unistr-iconv.patch (text/plain), 1.92 KB, created by
Alexey V. Novikov
on 2004-08-24 11:27:59 MSD
(
hide
)
Description:
Позволяет вводить в командной строке non-Latin1 имена пользователей
Filename:
MIME Type:
Creator:
Alexey V. Novikov
Created:
2004-08-24 11:27:59 MSD
Size:
1.92 KB
patch
obsolete
>diff -uNr rdesktop-1.3.1.orig/rdesktop.c rdesktop-1.3.1/rdesktop.c >--- rdesktop-1.3.1.orig/rdesktop.c 2004-01-21 13:51:19 +0300 >+++ rdesktop-1.3.1/rdesktop.c 2004-08-24 11:09:13 +0400 >@@ -27,6 +27,7 @@ > #include <sys/time.h> /* gettimeofday */ > #include <sys/times.h> /* times */ > #include <errno.h> >+#include <locale.h> > #include "rdesktop.h" > > #ifdef EGD_SOCKET >@@ -223,6 +224,10 @@ > flags = RDP_LOGON_NORMAL; > prompt_password = False; > domain[0] = password[0] = shell[0] = directory[0] = 0; >+ >+ /* Initalize locale support */ >+ setlocale(LC_ALL, ""); >+ > strcpy(keymapname, "en-us"); > > #ifdef RDP2VNC >diff -uNr rdesktop-1.3.1.orig/rdp.c rdesktop-1.3.1/rdp.c >--- rdesktop-1.3.1.orig/rdp.c 2003-12-11 20:20:01 +0300 >+++ rdesktop-1.3.1/rdp.c 2004-08-24 11:10:24 +0400 >@@ -19,6 +19,9 @@ > */ > > #include <time.h> >+#include <errno.h> >+#include <iconv.h> >+#include <langinfo.h> > #include "rdesktop.h" > > extern uint16 g_mcs_userid; >@@ -119,17 +122,37 @@ > void > rdp_out_unistr(STREAM s, char *string, int len) > { >- int i = 0, j = 0; >- >- len += 2; >- >- while (i < len) >- { >+ int i = 0, j = 0, initlen, avail; >+ char *incharset, *wptr, *outstr; >+ iconv_t cd; >+ >+ incharset = nl_langinfo(CODESET); >+ cd = iconv_open("UTF16LE", incharset); >+ if(cd == (iconv_t)-1) >+ { >+ if (errno == EINVAL) >+ error (0, 0, "conversion from '%s' to 'UTF16LE' not available", incharset); >+ else >+ perror ("iconv_open"); >+ error(0, 0, "Iconv conversion failed. Using build-in conversion to Latin1"); >+ len += 2; >+ while (i < len) >+ { > s->p[i++] = string[j++]; > s->p[i++] = 0; >- } >- >- s->p += len; >+ } >+ s->p += len; >+ return; >+ } >+ initlen = avail = len + 2; >+ len = strlen(string); >+ wptr = outstr = malloc(initlen); >+ iconv(cd, &string, &len, &wptr, &avail); >+ iconv_close(cd); >+ memset(s->p, '\0', initlen - avail + 2); >+ memcpy(s->p, outstr, initlen - avail); >+ s->p += initlen - avail + 2; >+ free(outstr); > } > > /* Parse a logon info packet */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5054
: 571