[Freeciv-Dev] Re: (PR#10242) current GTK2 civclient core dumps at startu
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10242 >
Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10242 >
>
> Brett Albertson wrote:
>
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=10242 >
>>
>>>[jdorje - Wed Sep 22 03:06:54 2004]:
>>>
>>>
>>>
>>>>[bretta - Tue Sep 21 17:39:02 2004]:
>>>
>>>>However, I am 99% certain that starting the civclient (built from CVS
>>>>sources updated last week) without FREECIV_LOCAL_ENCODING set did not
>>>>core dump.
>>>
>>>I doubt that. There were several patches to fix this problem but I
>>>don't know if we ever agreed on one. However I think it did work on
>>>Solaris using GNU libiconv. I presume you are using the native iconv now.
>>
>>
>>I think that you are right. I had your fprintf.diff patch applied. I
>>thought that was going to be committed to CVS since it was a real bug
>>(caused recursive error messages).
>
> That's a different bug, and it has been fixed. Your bug is that iconv
> doesn't recognize encoding "646".
Oops, I'm wrong. The fc_fprintf-before-initialization bug was fixed but
not the recursive-fc_fprintf bug.
This patch (based on the 2 earlier ones) should use UTF-8 instead of
encoding 646, and should avoid the recursive loop. How does it work?
Assuming that there is no client crash, do accented names show up
correctly in the client? What about in the server console?
jason
Index: utility/fciconv.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/fciconv.c,v
retrieving revision 1.6
diff -u -r1.6 fciconv.c
--- utility/fciconv.c 17 Sep 2004 16:26:21 -0000 1.6
+++ utility/fciconv.c 22 Sep 2004 15:29:56 -0000
@@ -83,6 +83,13 @@
* encoding is unconfigured. */
local_encoding = "ISO-8859-1";
}
+
+ if (mystrcasecmp(local_encoding, "646") == 0) {
+ /* HACK: On Solaris the encoding always comes up as "646" (ascii),
+ * which iconv doesn't understand. Work around it by using UTF-8
+ * instead. */
+ local_encoding = "UTF-8";
+ }
}
/* Set the internal encoding - first check $FREECIV_INTERNAL_ENCODING,
@@ -295,16 +302,27 @@
va_list ap;
char string[4096];
const char *output;
+ static bool recursion = FALSE;
+
+ /* The recursion variable is used to prevent a recursive loop. If
+ * an iconv conversion fails, then freelog will be called and an
+ * fc_fprintf will be done. But below we do another iconv conversion
+ * on the error messages, which is of course likely to fail also. */
+ if (recursion) {
+ return;
+ }
va_start(ap, format);
my_vsnprintf(string, sizeof(string), format, ap);
va_end(ap);
+ recursion = TRUE;
if (is_init) {
output = internal_to_local_string_static(string);
} else {
output = string;
}
+ recursion = FALSE;
fputs(output, stream);
fflush(stream);
|
|