bug-gnustep
[Top][All Lists]
Advanced

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

Re: Re[2]: Log Bug ?


From: Richard Frith-Macdonald
Subject: Re: Re[2]: Log Bug ?
Date: Mon, 18 Mar 2002 19:28:19 +0000

On Monday, March 18, 2002, at 06:56 PM, Manuel Guesdon wrote:

On Mon, 18 Mar 2002 12:45:48 +0100 Björn Gohla <b.gohla@gmx.de> wrote:

| On Monday 18 March 2002 12:18, Manuel Guesdon wrote:
| > Hi,
| >
| > When I log (with NSDebugFLog or NSDebugLog) string with characters like é,
| > I get strange characters: é
| >
| > He is an example:
| >     NSString* aTest=[NSString stringWithString:@"é"];
| >     NSString* aTest2=[NSString stringWithFormat:@"%@",@"é"];
| >     [aTest writeToFile:@"/tmp/zz"
| >            atomically:NO];
| >     NSDebugFLog(@"%@",aTest);
| >     [aTest2 writeToFile:@"/tmp/zz2"
| >            atomically:NO];
| >     NSDebugFLog(@"%@",aTest2);
| >
| > /tmp/zz and /tmp/zz2 are good but not the traces.
| >
| > BTW, I have GNUSTEP_STRING_ENCODING=NSISOLatin1StringEncoding in my env.
|
| this looks like the output is utf encoded while your terminal is in single
| byte mode.

Yes.  This was discussed on the mailing list quite a while back (I think
perhaps when syslog support was added) - and I went with what seemed to be the general consensus ... Since syslog doesn't handle wide unicode characters, we would output UTF8 where a logged message was not ascii. Perhaps it should attempt to use the default C string encoding before resorting to UTF8 though.

I don't think so:
When I read on the same term /tmp/zz2 and the log file there's a difference.

I've found another problem:
    NSString* aTest=[NSString stringWithString:@"é"];

I guess the NXConstantString code should probably strip the topmost bit to make that ascii, or perhaps raise an exception? I think the code doesn't do that because checking that the contents of a constant string are ascii characters
every time the string is used would be very inefficient.

NSMutableDictionary* dict=[NSMutableDictionary dictionaryWithObject:aTest
                                                   forKey:aTest];
    [dict writeToFile:@"/tmp/zz3"
           atomically:NO];
create a zz3 file like this:
        {
                "\U00e9" = "\U00e9";
        }
and not like this
        {
                "é" = "é";
        }


That's correct behavior afaik ... a property list is supposed to be ascii data with \U escapes for unicode characters (it's a locale independent format), so
the first form is correct.
If the property list was in MacOS-X format rather than OpenStep style format, it
would be XML and be entirely UTF8 anyway.


I *think* that the things you are seeing as problems are in fact correct behavior.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]