mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fixup -stringByAddingPercentEncodingWithAllowedCharacters: to ignore membership
of the supplied set if the character is not in the ASCII range.
This commit is contained in:
parent
9eb0fd4e1a
commit
0aeaee68da
1 changed files with 7 additions and 3 deletions
|
@ -1901,7 +1901,8 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
}
|
||||
}
|
||||
|
||||
- (NSString *) stringByAddingPercentEncodingWithAllowedCharacters: (NSCharacterSet *)aSet
|
||||
- (NSString *) stringByAddingPercentEncodingWithAllowedCharacters:
|
||||
(NSCharacterSet *)aSet
|
||||
{
|
||||
NSData *data = [self dataUsingEncoding: NSUTF8StringEncoding];
|
||||
NSString *s = nil;
|
||||
|
@ -1921,7 +1922,10 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
unsigned int hi;
|
||||
unsigned int lo;
|
||||
|
||||
if([aSet characterIsMember: c]) // if the character is in the allowed set, put it in
|
||||
/* If the character is in the allowed set *and* is in the
|
||||
* 7-bit ASCII range, it can be added unchanged.
|
||||
*/
|
||||
if (c < 128 && [aSet characterIsMember: c])
|
||||
{
|
||||
dst[dpos++] = c;
|
||||
}
|
||||
|
@ -1936,7 +1940,7 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
}
|
||||
s = [[NSString alloc] initWithBytes: dst
|
||||
length: dpos
|
||||
encoding: NSUTF8StringEncoding];
|
||||
encoding: NSASCIIStringEncoding];
|
||||
NSZoneFree(NSDefaultMallocZone(), dst);
|
||||
IF_NO_GC([s autorelease];)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue