Dear David,

would the following change help you?

Before i finalize this change (do this on encode as well, add to documentation, etc.),
was this omitted on purpose in naviserver?

-gustaf neumann

--- a/nsd/urlencode.c   Mon Oct 29 13:46:08 2012 +0100
+++ b/nsd/urlencode.c   Tue Oct 30 15:41:06 2012 +0100
@@ -504,8 +504,9 @@
 NsTclUrlDecodeObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj 
*CONST objv[])
 {
     Ns_DString   ds;
-    char        *string;
+    char        *string, *charset = NULL;
     int          part = 'q';
+    Tcl_Encoding encoding = NULL;
Ns_ObjvTable parts[] = {
         {"query",    'q'},
@@ -514,7 +515,8 @@
     };
     Ns_ObjvSpec opts[] = {
         {"-part",    Ns_ObjvIndex,   &part,   &parts},
-        {"--",       Ns_ObjvBreak,    NULL,    NULL},
+        {"-charset", Ns_ObjvString,  &charset, NULL},
+        {"--",       Ns_ObjvBreak,   NULL,    NULL},
         {NULL, NULL, NULL, NULL}
     };
     Ns_ObjvSpec args[] = {
@@ -526,7 +528,11 @@
     }
Ns_DStringInit(&ds);
-    UrlDecode(&ds, string, NULL, part);
+    if (charset) {
+        encoding = Ns_GetUrlEncoding(charset);
+    }
+
+    UrlDecode(&ds, string, encoding, part);
     Tcl_DStringResult(interp, &ds);
return TCL_OK;



On 30.10.12 11:38, David Osborne wrote:
Hi,

We're currently in the process of porting a fairly large code base from Aolserver to Naviserver for testing (using Naviserver v4.99.4 on Debian Squeeze).

One thing that has come up so far is that ns_urldecode seems to have dropped the "-charset" switch.

I'm assuming it used to be present since some of your documentation mentions it: (eg. http://naviserver.sourceforge.net/n/naviserver/files/ns_urldecode.html )
I can't find any mention of why it was dropped?

So in Naviserver, is there an alternative to achieve the following:

nscp 1> ns_urldecode -charset iso8859-1 "%FA"
รบ

PS. This is not really a devel question - is there a more appropriate place to ask config/user questions?

Thanks in advance.

- David


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to