@@ -26,20 +26,21 @@ #import "OFString.h" #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFArray.h" #import "OFDictionary.h" +#import "OFDataArray.h" +#import "OFSystemInfo.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFURL.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPClient.h" # import "OFHTTPRequest.h" # import "OFHTTPResponse.h" #endif -#import "OFDataArray.h" #import "OFXMLElement.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPRequestFailedException.h" #endif @@ -665,16 +666,10 @@ objc_autoreleasePoolPop(pool); return ret; } -+ (of_string_encoding_t)nativeOSEncoding -{ - /* FIXME */ - return OF_STRING_ENCODING_UTF_8; -} - - init { if (object_getClass(self) == [OFString class]) { @try { [self doesNotRecognizeSelector: _cmd]; @@ -832,12 +827,12 @@ OFFile *file; /* Make sure the file system is initialized */ [OFFile class]; - if (stat([path cStringWithEncoding: [OFString - nativeOSEncoding]], &st) == -1) + if (stat([path cStringWithEncoding: + [OFSystemInfo native8BitEncoding]], &st) == -1) @throw [OFOpenFileFailedException exceptionWithPath: path mode: @"rb"]; if (st.st_size > SIZE_MAX) @@ -1158,12 +1153,11 @@ encoding: encoding lossy: lossy]; break; default: - @throw [OFNotImplementedException exceptionWithSelector: _cmd - object: self]; + @throw [OFInvalidEncodingException exception]; } return cString; } @@ -1216,12 +1210,11 @@ case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: return [self length]; default: - @throw [OFNotImplementedException exceptionWithSelector: _cmd - object: self]; + @throw [OFInvalidEncodingException exception]; } } - (size_t)UTF8StringLength {