From: helge Date: Tue, 12 Oct 2004 14:37:26 +0000 (+0000) Subject: always load .strings files as Latin-1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52124b1f057dfb32fd0cc4ed9ac735128e8388d2;p=sope always load .strings files as Latin-1 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@247 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 9b96516f..93e410a2 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2004-10-12 Helge Hess + + * _WOStringTable.m: always open .strings files in ISO-Latin-1 encoding + (will be changed to UTF-8 later) (v4.3.63) + 2004-10-11 Helge Hess * SoObjects/SoObjCClass.m: fixed a bug in "Action" selector processing diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 5bc45e6d..a3c02e77 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=62 +SUBMINOR_VERSION:=63 # v4.3.42 requires libNGExtensions v4.3.116 # v4.3.40 requires libNGExtensions v4.3.115 diff --git a/sope-appserver/NGObjWeb/_WOStringTable.m b/sope-appserver/NGObjWeb/_WOStringTable.m index a22203c8..59b14364 100644 --- a/sope-appserver/NGObjWeb/_WOStringTable.m +++ b/sope-appserver/NGObjWeb/_WOStringTable.m @@ -25,6 +25,8 @@ @implementation _WOStringTable +static NSStringEncoding stringFilesEncoding = NSISOLatin1StringEncoding; + - (id)initWithPath:(NSString *)_path { if ((self = [super init])) { self->path = [_path copyWithZone:[self zone]]; @@ -54,6 +56,7 @@ - (void)checkState { NSString *tmp; NSDictionary *plist; + NSData *sdata; if (self->data != nil) return; @@ -75,7 +78,18 @@ /* If file was not a dictionary, then it's a standard strings file */ - if ((tmp = [NSString stringWithContentsOfFile:self->path]) == nil) { + if ((sdata = [[NSData alloc] initWithContentsOfFile:self->path]) == nil) { + [self debugWithFormat:@"ERROR: could not read strings file: %@", + self->path]; + self->data = nil; + return; + } + + tmp = [[NSString alloc] initWithData:sdata encoding:stringFilesEncoding]; + [sdata release]; sdata = nil; + if (tmp == nil) { + [self logWithFormat:@"ERROR: file is not in required encoding (%d): %@", + stringFilesEncoding, self->path]; self->data = nil; return; } @@ -86,10 +100,13 @@ __PRETTY_FUNCTION__, self->path); } + [tmp release]; tmp = nil; self->data = [plist copy]; } - NS_HANDLER + NS_HANDLER { + [tmp release]; tmp = nil; [[self _handlePropertyListParseException:localException] raise]; + } NS_ENDHANDLER; }