MacOS compatibilityy fixup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24013 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-11-02 08:33:23 +00:00
parent 7c594fd469
commit edd0e12b84
2 changed files with 18 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2006-11-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: ([stringByAddingPercentEscapesUsingEncoding:])
Make the set of characters escaped compatible with MacOS-X (10.4).
2006-11-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSortDescriptor.m; minor tidyups

View file

@ -1325,9 +1325,12 @@ handle_printf_atsign (FILE *stream,
* Constructs a new ASCII string which is a representation of the receiver
* in which characters are escaped where necessary in order to produce a
* legal URL.<br />
* Escaping is done for any character which is not 'unreserved' according
* to RFC2396. The unreserved characters are letters, digits, and the
* set of 'marks' characters ("-_.!~*'()").<br />
* The original string is converted to bytes using the specified encoding
* and then those bytes are escaped unless they correspond to 'legal'
* ASCII characters. The byte values escaped are any below 32 and any
* above 126 as well as 32 (space), 34 ("), 35 (#), 37 (%), 60 (&lt;),
* 62 (&gt;), 91 ([), 92 (\), 93 (]), 94 (^), 96 (~), 123 ({), 124 (|),
* and 125 (}).
* Returns nil if the receiver cannot be represented using the specified
* encoding.
*/
@ -1351,13 +1354,9 @@ handle_printf_atsign (FILE *stream,
unsigned int hi;
unsigned int lo;
if (isalpha(c) || isdigit(c)
|| c == '-' || c == '_' || c == '.' || c == '!' || c == '~'
|| c == '*' || c == '\'' || c == '(' || c == ')')
{
dst[dpos++] = c;
}
else
if (c <= 32 || c > 126 || c == 34 || c == 35 || c == 37
|| c == 60 || c == 62 || c == 91 || c == 92 || c == 93
|| c == 94 || c == 96 || c == 123 || c == 124 || c == 125)
{
dst[dpos++] = '%';
hi = (c & 0xf0) >> 4;
@ -1365,6 +1364,10 @@ handle_printf_atsign (FILE *stream,
lo = (c & 0x0f);
dst[dpos++] = (lo > 9) ? 'A' + lo - 10 : '0' + lo;
}
else
{
dst[dpos++] = c;
}
}
[d setLength: dpos];
s = [[NSString alloc] initWithData: d encoding: NSASCIIStringEncoding];