@@ -44,12 +44,19 @@ if ((retCString = malloc(([self UTF8StringLength] * 3) + 1)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: ([self UTF8StringLength] * 3) + 1]; for (i = 0; *string != '\0'; string++) { - if (isalnum((int)*string) || *string == '-' || *string == '_' || - *string == '.' || *string == '~') + /* + * '+' 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 == ',')) retCString[i++] = *string; else { uint8_t high, low; high = *string >> 4;