ObjFW  Check-in [92d8754e02]

Overview
Comment:Also handle '+' in -[stringByURLDecoding].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 92d8754e02a745b665599b43715f74abc256a66de3cdc6bb341db76dd9a2b9c6
User & Date: js on 2009-07-16 23:02:41
Other Links: manifest | tags
Context
2009-07-16
23:15
'~' does not need escaping in -[stringByURLEncoding]. check-in: eeaee04433 user: js tags: trunk
23:02
Also handle '+' in -[stringByURLDecoding]. check-in: 92d8754e02 user: js tags: trunk
2009-07-14
21:58
Also parse &#NNNN; and &#xHHHH; in -[stringByXMLUnescaping]. check-in: a80e9b948d user: js tags: trunk
Changes

Modified src/OFURLEncoding.m from [74051613f4] to [39517d09e4].

78
79
80
81
82
83
84


85
86
87
88
89
90
91
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93







+
+







						    andSize: length + 1];

	for (st = 0, i = 0, c = 0; *s; s++) {
		switch (st) {
		case 0:
			if (*s == '%')
				st = 1;
			else if (*s == '+')
				ret_c[i++] = ' ';
			else
				ret_c[i++] = *s;
			break;
		case 1:
		case 2:
			if (*s >= '0' && *s <= '9')
				c += (*s - '0') * (st == 1 ? 16 : 1);

Modified tests/OFString/OFString.m from [2dbe4533ed] to [465b61382e].

151
152
153
154
155
156
157

158

159
160
161
162
163
164
165
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
166







+
-
+







	CHECK([[a objectAtIndex: j++] isEqual: @""])
	CHECK([[a objectAtIndex: j++] isEqual: @"baz"])
	CHECK([[a objectAtIndex: j++] isEqual: @""])
	CHECK([[a objectAtIndex: j++] isEqual: @""])

	/* URL encoding tests */
	CHECK([[@"foo\"ba'_$" stringByURLEncoding] isEqual: @"foo%22ba%27_%24"])
	CHECK([[@"foo%20bar%22+%24" stringByURLDecoding]
	CHECK([[@"foo%20bar%22%24" stringByURLDecoding] isEqual: @"foo bar\"$"])
	    isEqual: @"foo bar\" $"])
	CHECK_EXCEPT([@"foo%bar" stringByURLDecoding],
	    OFInvalidEncodingException)
	CHECK_EXCEPT([@"foo%FFbar" stringByURLDecoding],
	    OFInvalidEncodingException)

	/* Replace tests */
	s1 = [@"asd fo asd fofo asd" mutableCopy];