Enlightenment CVS committal
Author : swielinga
Project : eterm
Module : Eterm
Dir : eterm/Eterm/src
Modified Files:
command.c
Log Message:
Fixed the obvious errors in this UTF-8 code. It doesn't produce gibberish
anymore, though it doesn't appear to be multilingual heaven just quite yet.
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/command.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- command.c 17 Dec 2004 21:37:37 -0000 1.102
+++ command.c 18 Dec 2004 19:04:12 -0000 1.103
@@ -34,7 +34,7 @@
* he guarantee anything whatsoever.
*----------------------------------------------------------------------*/
-static const char cvs_ident[] = "$Id: command.c,v 1.102 2004/12/17 21:37:37
mej Exp $";
+static const char cvs_ident[] = "$Id: command.c,v 1.103 2004/12/18 19:04:12
swielinga Exp $";
/* includes: */
#include "config.h"
@@ -3520,7 +3520,7 @@
if (encoding_method != UCS2) {
set_multichar_encoding("utf8");
}
- handle = iconv_open("UTF-8", "WCHAR_T");
+ handle = iconv_open("WCHAR_T", "UTF-8");
if (handle == SPIF_CAST_C(iconv_t) -1) {
print_error("Unable to decode UTF-8 locale %s to WCHAR_T.
Defaulting to portable C locale.\n",
setlocale(LC_ALL, ""));
@@ -3530,16 +3530,17 @@
char *outbuff, *pinbuff, *poutbuff;
wchar_t *wcbuff;
mbstate_t mbs;
- size_t bufflen, outlen = 0, retval;
+ size_t bufflen, outlen = 0, outbufflen, retval;
pinbuff = (char *) str;
bufflen = cmdbuf_ptr - str;
- outlen = bufflen * 6;
+ outbufflen = outlen = bufflen * 6;
poutbuff = outbuff = SPIF_CAST_C(char *) MALLOC(outlen);
errno = 0;
D_VT(("Allocated output buffer of %lu chars at %010p
against input buffer of %lu\n", bufflen * 6, outbuff, bufflen));
print_warning("Moo: %s\n", safe_print_string(str,
bufflen));
retval = iconv(handle, &pinbuff, &bufflen, &poutbuff,
&outlen);
+ outlen = outbufflen - outlen;
if (retval != (size_t) -1) {
errno = 0;
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs