Overview
Comment: | Add -[stringByURLEncodingWithIgnoredCharacters:] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7b2f48cf71adbe0c1399a7f35e21a824 |
User & Date: | js on 2015-06-30 19:56:25 |
Other Links: | manifest | tags |
Context
2015-06-30
| ||
20:56 | OFURL: Properly handle escaping / unescaping check-in: d94375547e user: js tags: trunk | |
19:56 | Add -[stringByURLEncodingWithIgnoredCharacters:] check-in: 7b2f48cf71 user: js tags: trunk | |
2015-06-28
| ||
18:06 | Update to Unicode 8.0 check-in: 44f1c04c03 user: js tags: trunk | |
Changes
Modified src/OFString+URLEncoding.h from [7aab8630a9] to [3beccffb40].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /*! * @brief Encodes a string for use in a URL. * * @return A new autoreleased string */ - (OFString*)stringByURLEncoding; /*! * @brief Decodes a string used in a URL. * * @return A new autoreleased string */ - (OFString*)stringByURLDecoding; @end OF_ASSUME_NONNULL_END | > > > > > > > > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | /*! * @brief Encodes a string for use in a URL. * * @return A new autoreleased string */ - (OFString*)stringByURLEncoding; /*! * @brief Encodes a string for use in a URL, but does not escape the specified * ignored characters. * * @param ignored A C string of characters that should not be escaped * * @return A new autoreleased string */ - (OFString*)stringByURLEncodingWithIgnoredCharacters: (const char*)ignored; /*! * @brief Decodes a string used in a URL. * * @return A new autoreleased string */ - (OFString*)stringByURLDecoding; @end OF_ASSUME_NONNULL_END |
Modified src/OFString+URLEncoding.m from [52af0e7dc7] to [1b09d47d68].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* Reference for static linking */ int _OFString_URLEncoding_reference; @implementation OFString (URLEncoding) - (OFString*)stringByURLEncoding { void *pool = objc_autoreleasePoolPush(); const char *string = [self UTF8String]; char *retCString; size_t i; OFString *ret; /* | > > > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /* Reference for static linking */ int _OFString_URLEncoding_reference; @implementation OFString (URLEncoding) - (OFString*)stringByURLEncoding { return [self stringByURLEncodingWithIgnoredCharacters: ""]; } - (OFString*)stringByURLEncodingWithIgnoredCharacters: (const char*)ignored { void *pool = objc_autoreleasePoolPush(); const char *string = [self UTF8String]; char *retCString; size_t i; OFString *ret; /* |
︙ | ︙ | |||
51 52 53 54 55 56 57 | * '+' is also listed in RFC 1738, however, '+' is sometimes * interpreted as space in HTTP. Therefore always escape it to * make sure it's always interpreted correctly. */ if (!(*string & 0x80) && (isalnum((int)*string) || *string == '$' || *string == '-' || *string == '_' || *string == '.' || *string == '!' || *string == '*' || | | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | * '+' is also listed in RFC 1738, however, '+' is sometimes * interpreted as space in HTTP. Therefore always escape it to * make sure it's always interpreted correctly. */ if (!(*string & 0x80) && (isalnum((int)*string) || *string == '$' || *string == '-' || *string == '_' || *string == '.' || *string == '!' || *string == '*' || *string == '(' || *string == ')' || *string == ',' || strchr(ignored, *string) != NULL)) retCString[i++] = *string; else { uint8_t high, low; high = *string >> 4; low = *string & 0x0F; |
︙ | ︙ |