[OGo-Developer] multipart/form-data and text encoding

Wolfgang Sourdeau developer@opengroupware.org
Thu, 23 Aug 2007 15:16:42 -0400


> *Though* the default charset for HTTP is Latin-1, not UTF-8. So this  
> is non exactly correct.
> Putting the behaviour into a delegate method sounds like a sane thing  
> to do, though using UTF-8 as the default (instead of Latin1) _might_  
> be viable too (would need to be checked against OGo which does rely  
> on Latin1).

My patch returns a default based on "WOMessgeUseUTF8":

--- NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m  (r=C3=A9vision 1528)
+++ NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m  (copie de travail)
@@ -31,6 +31,7 @@
 #include <NGObjWeb/WOCookie.h>
 #include <NGExtensions/NSData+gzip.h>
 #include <NGHttp/NGHttp.h>
+#include <NGMime/NGMimeType.h>
 #include "common.h"

 #include <string.h>
@@ -60,6 +61,7 @@
 static BOOL useSimpleParser =3D YES;
 static int  doCore  =3D -1;
 static NSString *adLogPath         =3D nil;
+static NGMimeType *defaultMimeType =3D nil;
 static NGLogger *debugLogger       =3D nil;
 static NGLogger *perfLogger        =3D nil;
 static NGLogger *transActionLogger =3D nil;
@@ -83,7 +85,11 @@
   ud =3D [NSUserDefaults standardUserDefaults];
   useSimpleParser =3D [ud boolForKey:@"WOHttpTransactionUseSimpleParser"];
   doCore =3D [[ud objectForKey:@"WOCoreOnHTTPAdaptorException"] boolValue]?1:0;
-
+  if ([ud boolForKey: @"WOMessageUseUTF8"])
+    defaultMimeType =3D [NGMimeType mimeType: @"text/plain; charset=3Dutf-8"];
+  else
+    defaultMimeType =3D [NGMimeType mimeType: @"text/plain; charset=3Diso-8859-1"];
+  [defaultMimeType retain];
   adLogPath =3D [[ud stringForKey:@"WOAdaptorLogPath"] copy];
   if (adLogPath =3D=3D nil) adLogPath =3D @"";
 }


... so this problem is handled already ;)


W.