Index: src/OFURLEncoding.m ================================================================== --- src/OFURLEncoding.m +++ src/OFURLEncoding.m @@ -40,11 +40,12 @@ 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 == '.') + if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' || + *s == '~') ret_c[i++] = *s; else { char buf[3]; snprintf(buf, 3, "%02X", *s); ret_c[i++] = '%'; Index: tests/OFString/OFString.m ================================================================== --- tests/OFString/OFString.m +++ tests/OFString/OFString.m @@ -152,11 +152,12 @@ 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\"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],