mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-16 00:21:39 +00:00
Add more control over encoding of string values from form.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@19673 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
05b5fd8bdb
commit
5336129e50
3 changed files with 56 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jul 02 17:40:00 2004 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* WebServer.m: Add control over character encoding used to
|
||||
interpret form data.
|
||||
|
||||
Thu Jul 02 13:25:00 2004 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* WebServer.m: Fix error response when an exception occurs.
|
||||
|
|
26
WebServer.h
26
WebServer.h
|
@ -189,16 +189,34 @@
|
|||
- (NSData*) parameter: (NSString*)name from: (NSDictionary*)params;
|
||||
|
||||
/**
|
||||
* Calls -parameter:at:from: and if the result is non-nil converts the
|
||||
* data to a string using UTF8 encoding.
|
||||
* Calls -parameterString:at:from:charset: with a nil charset so that
|
||||
* UTF-8 encoding is used for string conversion.
|
||||
*/
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
at: (unsigned)index
|
||||
from: (NSDictionary*)params;
|
||||
/**
|
||||
* Calls -parameterString:at:from: with an index of zero.
|
||||
* Calls -parameter:at:from: and, if the result is non-nil
|
||||
* converts the data to a string using the specified mime
|
||||
* characterset, (if charset is nil, UTF-8 is used).
|
||||
*/
|
||||
- (NSString*) parameterString: (NSString*)name from: (NSDictionary*)params;
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
at: (unsigned)index
|
||||
from: (NSDictionary*)params
|
||||
charset: (NSString*)charset;
|
||||
/**
|
||||
* Calls -parameterString:at:from:charset: with an index of zero and
|
||||
* a nil value for charset (which causes data to be treated as UTF-8).
|
||||
*/
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
from: (NSDictionary*)params;
|
||||
|
||||
/**
|
||||
* Calls -parameterString:at:from:charset: with an index of zero.
|
||||
*/
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
from: (NSDictionary*)params
|
||||
charset: (NSString*)charset;
|
||||
|
||||
/**
|
||||
* Loads a template file from disk and places it in aResponse as content
|
||||
|
|
31
WebServer.m
31
WebServer.m
|
@ -457,20 +457,46 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf)
|
|||
- (NSString*) parameterString: (NSString*)name
|
||||
at: (unsigned)index
|
||||
from: (NSDictionary*)params
|
||||
{
|
||||
return [self parameterString: name at: index from: params charset: nil];
|
||||
}
|
||||
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
at: (unsigned)index
|
||||
from: (NSDictionary*)params
|
||||
charset: (NSString*)charset
|
||||
{
|
||||
NSData *d = [self parameter: name at: index from: params];
|
||||
NSString *s = nil;
|
||||
|
||||
if (d != nil)
|
||||
{
|
||||
s = [[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding];
|
||||
s = [NSString alloc];
|
||||
if (charset == nil || [charset length] == 0)
|
||||
{
|
||||
s = [s initWithData: d encoding: NSUTF8StringEncoding];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSStringEncoding enc;
|
||||
|
||||
enc = [GSMimeDocument encodingFromCharset: charset];
|
||||
s = [s initWithData: d encoding: enc];
|
||||
}
|
||||
}
|
||||
return AUTORELEASE(s);
|
||||
}
|
||||
|
||||
- (NSString*) parameterString: (NSString*)name from: (NSDictionary*)params
|
||||
{
|
||||
return [self parameterString: name at: 0 from: params];
|
||||
return [self parameterString: name at: 0 from: params charset: nil];
|
||||
}
|
||||
|
||||
- (NSString*) parameterString: (NSString*)name
|
||||
from: (NSDictionary*)params
|
||||
charset: (NSString*)charset
|
||||
{
|
||||
return [self parameterString: name at: 0 from: params charset: charset];
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id)anObject
|
||||
|
@ -940,6 +966,7 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf)
|
|||
|
||||
parser = [GSMimeParser new];
|
||||
[parser setIsHttp];
|
||||
[parser setDefaultCharset: @"utf-8"];
|
||||
|
||||
doc = [parser mimeDocument];
|
||||
|
||||
|
|
Loading…
Reference in a new issue