Overview
Comment: | '~' does not need escaping in -[stringByURLEncoding]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
eeaee044330847cbdde3cb659d7caf48 |
User & Date: | js on 2009-07-16 23:15:00 |
Other Links: | manifest | tags |
Context
2009-07-16
| ||
23:59 | OFConstString: Throw OFNotImplementedException for unavailable methods. check-in: 9bcba32807 user: js tags: trunk | |
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 | |
Changes
Modified src/OFURLEncoding.m from [39517d09e4] to [05ac91dbb0].
︙ | ︙ | |||
38 39 40 41 42 43 44 | * @"" literal. */ if ((ret_c = malloc((length * 3) + 1)) == NULL) @throw [OFOutOfMemoryException newWithClass: isa andSize: (length * 3) + 1]; for (i = 0; *s != '\0'; s++) { | | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | * @"" literal. */ if ((ret_c = malloc((length * 3) + 1)) == NULL) @throw [OFOutOfMemoryException newWithClass: isa andSize: (length * 3) + 1]; for (i = 0; *s != '\0'; s++) { if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' || *s == '~') ret_c[i++] = *s; else { char buf[3]; snprintf(buf, 3, "%02X", *s); ret_c[i++] = '%'; ret_c[i++] = buf[0]; ret_c[i++] = buf[1]; |
︙ | ︙ |
Modified tests/OFString/OFString.m from [465b61382e] to [59018dd6bd].
︙ | ︙ | |||
150 151 152 153 154 155 156 | CHECK([[a objectAtIndex: j++] isEqual: @"bar"]) CHECK([[a objectAtIndex: j++] isEqual: @""]) CHECK([[a objectAtIndex: j++] isEqual: @"baz"]) CHECK([[a objectAtIndex: j++] isEqual: @""]) CHECK([[a objectAtIndex: j++] isEqual: @""]) /* URL encoding tests */ | > | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | CHECK([[a objectAtIndex: j++] isEqual: @"bar"]) 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] isEqual: @"foo bar\" $"]) CHECK_EXCEPT([@"foo%bar" stringByURLDecoding], OFInvalidEncodingException) CHECK_EXCEPT([@"foo%FFbar" stringByURLDecoding], OFInvalidEncodingException) |
︙ | ︙ |