@@ -93,10 +93,12 @@ bool); extern bool of_unicode_to_windows_1252(const of_unichar_t*, uint8_t*, size_t, bool); extern bool of_unicode_to_codepage_437(const of_unichar_t*, uint8_t*, size_t, bool); +extern bool of_unicode_to_codepage_850(const of_unichar_t*, uint8_t*, size_t, + bool); /* References for static linking */ void _references_to_categories_of_OFString(void) { @@ -1120,10 +1122,21 @@ length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; + return length; + case OF_STRING_ENCODING_CODEPAGE_850: + if (length + 1 > maxLength) + @throw [OFOutOfRangeException exception]; + + if (!of_unicode_to_codepage_850(characters, (uint8_t*)cString, + length, lossy)) + @throw [OFInvalidEncodingException exception]; + + cString[length] = '\0'; + return length; default: @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } @@ -1178,10 +1191,11 @@ case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: + case OF_STRING_ENCODING_CODEPAGE_850: cString = [object allocMemoryWithSize: length + 1]; [self OF_getCString: cString maxLength: length + 1 encoding: encoding @@ -1242,10 +1256,11 @@ case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: + case OF_STRING_ENCODING_CODEPAGE_850: return [self length]; default: @throw [OFInvalidEncodingException exception]; } }