ObjFW  Check-in [bbe91438b1]

Overview
Comment:Accept cp* and cp-* as encoding name
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bbe91438b1462926e08be6963eaf90c2a6bd39ed1350703f4842b9c40f79705b
User & Date: js on 2017-01-11 04:44:03
Other Links: manifest | tags
Context
2017-01-15
04:32
Add codepage 858 check-in: adbf31f2f9 user: js tags: trunk
2017-01-11
04:44
Accept cp* and cp-* as encoding name check-in: bbe91438b1 user: js tags: trunk
04:33
Reduce code duplication check-in: 44ea4f9322 user: js tags: trunk
Changes

Modified src/OFHTTPResponse.m from [53242c671e] to [d85b1be09a].

113
114
115
116
117
118
119
120


121
122


123






124
125
126
127
128
129
130

		if ([contentType hasSuffix: @"charset=utf-8"])
			encoding = OF_STRING_ENCODING_UTF_8;
		else if ([contentType hasSuffix: @"charset=iso-8859-1"])
			encoding = OF_STRING_ENCODING_ISO_8859_1;
		else if ([contentType hasSuffix: @"charset=iso-8859-15"])
			encoding = OF_STRING_ENCODING_ISO_8859_15;
		else if ([contentType hasSuffix: @"charset=windows-1251"])


			encoding = OF_STRING_ENCODING_WINDOWS_1251;
		else if ([contentType hasSuffix: @"charset=windows-1252"])


			encoding = OF_STRING_ENCODING_WINDOWS_1252;






		else if ([contentType hasSuffix: @"charset=macintosh"])
			encoding = OF_STRING_ENCODING_MAC_ROMAN;
	}

	if (encoding == OF_STRING_ENCODING_AUTODETECT)
		encoding = OF_STRING_ENCODING_UTF_8;








|
>
>

|
>
>

>
>
>
>
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

		if ([contentType hasSuffix: @"charset=utf-8"])
			encoding = OF_STRING_ENCODING_UTF_8;
		else if ([contentType hasSuffix: @"charset=iso-8859-1"])
			encoding = OF_STRING_ENCODING_ISO_8859_1;
		else if ([contentType hasSuffix: @"charset=iso-8859-15"])
			encoding = OF_STRING_ENCODING_ISO_8859_15;
		else if ([contentType hasSuffix: @"charset=windows-1251"] ||
		    [contentType hasSuffix: @"charset=cp1251"] ||
		    [contentType hasSuffix: @"charset=cp-1251"])
			encoding = OF_STRING_ENCODING_WINDOWS_1251;
		else if ([contentType hasSuffix: @"charset=windows-1252"] ||
		    [contentType hasSuffix: @"charset=cp1252"] ||
		    [contentType hasSuffix: @"charset=cp-1252"])
			encoding = OF_STRING_ENCODING_WINDOWS_1252;
		else if ([contentType hasSuffix: @"charset=cp437"] ||
		    [contentType hasSuffix: @"charset=cp-437"])
			encoding = OF_STRING_ENCODING_CODEPAGE_437;
		else if ([contentType hasSuffix: @"charset=cp850"] ||
		    [contentType hasSuffix: @"charset=cp-850"])
			encoding = OF_STRING_ENCODING_CODEPAGE_850;
		else if ([contentType hasSuffix: @"charset=macintosh"])
			encoding = OF_STRING_ENCODING_MAC_ROMAN;
	}

	if (encoding == OF_STRING_ENCODING_AUTODETECT)
		encoding = OF_STRING_ENCODING_UTF_8;

Modified src/OFXMLParser.m from [d432f9b587] to [5a770f7e7b].

468
469
470
471
472
473
474
475


476
477
478


479
480








481
482
483
484
485
486
487
					_encoding = OF_STRING_ENCODING_UTF_8;
				else if ([value isEqual: @"iso-8859-1"])
					_encoding =
					    OF_STRING_ENCODING_ISO_8859_1;
				else if ([value isEqual: @"iso-8859-15"])
					_encoding =
					    OF_STRING_ENCODING_ISO_8859_15;
				else if ([value isEqual: @"windows-1251"])


					_encoding =
					    OF_STRING_ENCODING_WINDOWS_1251;
				else if ([value isEqual: @"windows-1252"])


					_encoding =
					    OF_STRING_ENCODING_WINDOWS_1252;








				else if ([value isEqual: @"macintosh"])
					_encoding =
					    OF_STRING_ENCODING_MAC_ROMAN;
				else
					return false;
			}








|
>
>


|
>
>


>
>
>
>
>
>
>
>







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
					_encoding = OF_STRING_ENCODING_UTF_8;
				else if ([value isEqual: @"iso-8859-1"])
					_encoding =
					    OF_STRING_ENCODING_ISO_8859_1;
				else if ([value isEqual: @"iso-8859-15"])
					_encoding =
					    OF_STRING_ENCODING_ISO_8859_15;
				else if ([value isEqual: @"windows-1251"] ||
				    [value isEqual: @"cp1251"] ||
				    [value isEqual: @"cp-1251"])
					_encoding =
					    OF_STRING_ENCODING_WINDOWS_1251;
				else if ([value isEqual: @"windows-1252"] ||
				    [value isEqual: @"cp1252"] ||
				    [value isEqual: @"cp-1252"])
					_encoding =
					    OF_STRING_ENCODING_WINDOWS_1252;
				else if ([value isEqual: @"cp437"] ||
				    [value isEqual: @"cp-437"])
					_encoding =
					    OF_STRING_ENCODING_CODEPAGE_437;
				else if ([value isEqual: @"cp850"] ||
				    [value isEqual: @"cp-850"])
					_encoding =
					    OF_STRING_ENCODING_CODEPAGE_850;
				else if ([value isEqual: @"macintosh"])
					_encoding =
					    OF_STRING_ENCODING_MAC_ROMAN;
				else
					return false;
			}