/[Apache-SVN]/perl/embperl/trunk/epinit.c
ViewVC logotype

Diff of /perl/embperl/trunk/epinit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- perl/embperl/trunk/epinit.c	2005/11/09 08:10:36	331994
+++ perl/embperl/trunk/epinit.c	2005/11/09 08:11:00	331995
@@ -141,6 +141,7 @@ tOptionEntry OptionsOPTIONS[] =
     OPTION_OPT(DisableSelectScan)
     OPTION_OPT(ShowBacktrace)
     OPTION_OPT(EnableChdir)
+    OPTION_OPT(FormDataNoUtf8)
     } ;
 
 
@@ -1011,7 +1012,10 @@ static int embperl_GetFormData (/*i/o*/
     AV *    pFormArray      = r -> pThread -> pFormArray ;
     HV *    pFormHash       = r -> pThread -> pFormHash ;
     bool    bAll            = (r -> Config.bOptions & optAllFormData) != 0 ;
+    bool    bNoUtf8         = (r -> Config.bOptions & optFormDataNoUtf8) != 0 ;
     bool    bDebug          = (r -> Config.bDebug   & dbgForm) != 0 ;
+    int     mayutf8  = 0 ;
+    char    c ;
     epTHX ;
 
     if (nLen == 0)
@@ -1111,6 +1115,10 @@ static int embperl_GetFormData (/*i/o*/
 			else
 			    { /* New Field -> store it */
 			    pSVV = newSVpv (pVal, nVal) ;
+#ifdef UTF8_IS_START
+			    if (mayutf8 && is_utf8_string(pVal, nVal))
+			    	SvUTF8_on (pSVV) ;
+#endif
 			    if (hv_store (pFormHash, pKey, nKey, pSVV, 0) == NULL)
 				{
 				_free (r, pMem) ;
@@ -1130,7 +1138,8 @@ static int embperl_GetFormData (/*i/o*/
                     }
                 pKey = pVal = p ;
                 nKey = nVal = 0 ;
-                
+		mayutf8 = 0 ;
+				                
                 if (*pQueryString == '\0')
                     {
                     _free (r, pMem) ;
@@ -1140,8 +1149,12 @@ static int embperl_GetFormData (/*i/o*/
                 
                 break ;
             default:
-                *p++ = *pQueryString++ ;
+                c = *p++ = *pQueryString++ ;
                 nLen-- ;
+#ifdef UTF8_IS_START
+                if (!bNoUtf8)
+                    mayutf8 += UTF8_IS_START(c) ;
+#endif
                 break ;
             }
         }

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26