@@ -26,10 +26,12 @@ #include #import "OFString.h" +#import "OFInvalidEncodingException.h" + #import "asprintf.h" #import "autorelease.h" #import "macros.h" #define MAX_SUBFORMAT_LEN 64 @@ -310,10 +312,26 @@ "(nil)"); } @catch (id e) { free(ctx->buffer); @throw e; } + + break; + case 'C': + ctx->subformat[ctx->subformatLen - 1] = 's'; + + { + char buffer[5]; + size_t len = of_string_utf8_encode( + va_arg(ctx->arguments, of_unichar_t), buffer); + + if (len == 0) + @throw [OFInvalidEncodingException exception]; + + buffer[len] = 0; + tmpLen = asprintf(&tmp, ctx->subformat, buffer); + } break; case 'd': case 'i': switch (ctx->lengthModifier) {