Re: Does anyone know X and utf-8? Help us with ui i18n prob.

On Monday 24 August 2009 18:12:11 Wang Diancheng wrote:
> It is indeed, following is a simple patch to fix the utf-8 related
> bug. Note that this patch only keep it compatible with utf-8 charset, I
> don't known other charsets' status.

Your patch seems to assume that all octets from 128 to 255 correspond to 
printable characters. That is not true for UTF-8 or any other character 
encoding I know of.  I think it is better just to make c unsigned char, which 
makes the code behave as intended - and documented.

> I think it is better remove 'Escape
> all control codes' (print-escape value) completely.

I don't think so.  Perhaps print-escape should default to false at least in 
the interactive interpreter, but it is useful to be able to set it to true. 
Librep has no concept of a character set: strings are just arrays of octets 
that in some cases might not correspond to printable text in any encoding.

	Timo Korvola		<URL:>
diff --git a/src/lisp.c b/src/lisp.c
index c04473c..acbb999 100644
--- a/src/lisp.c
+++ b/src/lisp.c
@@ -2277,7 +2277,7 @@ rep_string_print(repv strm, repv obj)
     char *s = rep_STR(obj);
     char buf[BUFSIZ];
     int bufptr = 0;
-    char c;
+    unsigned char c;
 #define OUT(c)							\
     do {							\

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]