ObjFW  Diff

Differences From Artifact [6583af04e3]:

To Artifact [04e9fd7c64]:


322
323
324
325
326
327
328






329
330
331
332
333
334
335
	   length: (size_t)len
{
	self = [super init];

	@try {
		size_t i, j;
		const uint16_t *table;







		string = [self allocMemoryWithSize: len + 1];
		length = len;

		if (encoding == OF_STRING_ENCODING_UTF_8) {
			switch (of_string_check_utf8(str, length)) {
			case 1:







>
>
>
>
>
>







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
	   length: (size_t)len
{
	self = [super init];

	@try {
		size_t i, j;
		const uint16_t *table;

		if (encoding == OF_STRING_ENCODING_UTF_8 &&
		    len >= 3 && !memcmp(str, "\xEF\xBB\xBF", 3)) {
			str += 3;
			len -= 3;
		}

		string = [self allocMemoryWithSize: len + 1];
		length = len;

		if (encoding == OF_STRING_ENCODING_UTF_8) {
			switch (of_string_check_utf8(str, length)) {
			case 1: