+2004-10-12 Helge Hess <helge.hess@skyrix.com>
+
+ * _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 <helge.hess@opengroupware.org>
* SoObjects/SoObjCClass.m: fixed a bug in "Action" selector processing
@implementation _WOStringTable
+static NSStringEncoding stringFilesEncoding = NSISOLatin1StringEncoding;
+
- (id)initWithPath:(NSString *)_path {
if ((self = [super init])) {
self->path = [_path copyWithZone:[self zone]];
- (void)checkState {
NSString *tmp;
NSDictionary *plist;
+ NSData *sdata;
if (self->data != nil)
return;
/* 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;
}
__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;
}