Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl-cvs

svn commit: r331995 - in /perl/embperl/trunk: Changes.pod embperl.h epinit.c podsrc/Config.spod test.pl test/cmp/escutf8.htm test/html/escutf8.htm

 

 

ModPerl embperl-cvs RSS feed   Index | Next | Previous | View Threaded


richter at apache

Nov 9, 2005, 12:11 AM

Post #1 of 1 (1100 views)
Permalink
svn commit: r331995 - in /perl/embperl/trunk: Changes.pod embperl.h epinit.c podsrc/Config.spod test.pl test/cmp/escutf8.htm test/html/escutf8.htm

Author: richter
Date: Wed Nov 9 00:11:00 2005
New Revision: 331995

URL: http://svn.apache.org/viewcvs?rev=331995&view=rev
Log:
- Form data that is send to Embperl and put into %fdat
get now Perl's internal UTF8 flags set, in case
the data posted contains a valid UTF8 string.
This can be disabled with the option
optFormDataNoUtf8.


Modified:
perl/embperl/trunk/Changes.pod
perl/embperl/trunk/embperl.h
perl/embperl/trunk/epinit.c
perl/embperl/trunk/podsrc/Config.spod
perl/embperl/trunk/test.pl
perl/embperl/trunk/test/cmp/escutf8.htm
perl/embperl/trunk/test/html/escutf8.htm

Modified: perl/embperl/trunk/Changes.pod
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/Changes.pod?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/Changes.pod (original)
+++ perl/embperl/trunk/Changes.pod Wed Nov 9 00:11:00 2005
@@ -10,6 +10,11 @@
(For UTF-8 this is not necessary when Perl's UTF-8
Flag is correctly set, but this is not the case
for all datasources)
+ - Form data that is send to Embperl and put into %fdat
+ get now Perl's internal UTF8 flags set, in case
+ the data posted contains a valid UTF8 string.
+ This can be disabled with the option
+ optFormDataNoUtf8.
- Added Module Embperl::Inline, which allows to embed
Embperl code in an ordinary Perl module. This makes
is easy to install system wide libraries, which need

Modified: perl/embperl/trunk/embperl.h
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/embperl.h?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/embperl.h (original)
+++ perl/embperl/trunk/embperl.h Wed Nov 9 00:11:00 2005
@@ -175,8 +175,9 @@
optOpenLogEarly = 0x200000,
optNoUncloseWarn = 0x400000,
optDisableSelectScan = 0x800000,
- optShowBacktrace = 0x8000000,
- optEnableChdir = 0x1000000
+ optEnableChdir = 0x1000000,
+ optFormDataNoUtf8 = 0x2000000,
+ optShowBacktrace = 0x8000000
} ;

/* --- output escaping --- */

Modified: perl/embperl/trunk/epinit.c
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/epinit.c?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/epinit.c (original)
+++ perl/embperl/trunk/epinit.c Wed Nov 9 00:11:00 2005
@@ -141,6 +141,7 @@
OPTION_OPT(DisableSelectScan)
OPTION_OPT(ShowBacktrace)
OPTION_OPT(EnableChdir)
+ OPTION_OPT(FormDataNoUtf8)
} ;


@@ -1011,7 +1012,10 @@
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 @@
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 @@
}
pKey = pVal = p ;
nKey = nVal = 0 ;
-
+ mayutf8 = 0 ;
+
if (*pQueryString == '\0')
{
_free (r, pMem) ;
@@ -1140,8 +1149,12 @@

break ;
default:
- *p++ = *pQueryString++ ;
+ c = *p++ = *pQueryString++ ;
nLen-- ;
+#ifdef UTF8_IS_START
+ if (!bNoUtf8)
+ mayutf8 += UTF8_IS_START(c) ;
+#endif
break ;
}
}

Modified: perl/embperl/trunk/podsrc/Config.spod
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/podsrc/Config.spod?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/podsrc/Config.spod (original)
+++ perl/embperl/trunk/podsrc/Config.spod Wed Nov 9 00:11:00 2005
@@ -987,6 +987,15 @@
with the posted form data.
Set this when using Execute from your perl script and you have already read the Form Data (via eg. CGI.pm).

+=item optFormDataNoUtf8 = 0x2000000
+
+By default Embperl checks all formfields in %fdat
+if they contain valid UTF-8 strings and if yes sets Perl's
+internals UTF-8 flag.
+
+If this option is set Embperl will never set the UTF-8 on any
+data in %fdat.
+

=item optAllFormData = 8192


Modified: perl/embperl/trunk/test.pl
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/test.pl?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/test.pl (original)
+++ perl/embperl/trunk/test.pl Wed Nov 9 00:11:00 2005
@@ -201,6 +201,8 @@
'version' => 1,
},
'escutf8.htm' => {
+ 'query_info' => "poststd=abcäöü&postutf8=abcäöü",
+ 'offline' => 1,
},
'spaces.htm' => {
'version' => 1,

Modified: perl/embperl/trunk/test/cmp/escutf8.htm
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/test/cmp/escutf8.htm?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/test/cmp/escutf8.htm (original)
+++ perl/embperl/trunk/test/cmp/escutf8.htm Wed Nov 9 00:11:00 2005
@@ -16,6 +16,9 @@
<input name="utf8" value="abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©">
<textarea name="utf8">abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©</textarea>

+poststd: <input name="poststd" value="abc&auml;&ouml;&uuml;">
+postutf8: <input name="postutf8" value="abcäöü">
+
$escmode = 8 ;
abc!"$%&()<>=äöüÄÖÜß -> abc!&apos;&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©
<input name="test" value="abc!&apos;&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©">
@@ -46,6 +49,9 @@
<input name="utf8" value="abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©">
<textarea name="utf8">abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©</textarea>

+poststd: <input name="poststd" value="abc&auml;&ouml;&uuml;">
+postutf8: <input name="postutf8" value="abcäöü">
+
$escmode = 8 ;
abc!"$%&()<>=äöüÄÖÜß -> abc!&apos;&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©
<input name="test" value="abc!&apos;&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©">
@@ -75,6 +81,9 @@
abc!"$%&()<>=äöüÄÖÜß -> abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©
<input name="utf8" value="abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©">
<textarea name="utf8">abc!'&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©</textarea>
+
+poststd: <input name="poststd" value="abcäöü">
+postutf8: <input name="postutf8" value="abcäöü">

$escmode = 8 ;
abc!"$%&()<>=äöüÄÖÜß -> abc!&apos;&quot;0&amp;()&lt;&gt;=äöüÄÖÜß©

Modified: perl/embperl/trunk/test/html/escutf8.htm
URL: http://svn.apache.org/viewcvs/perl/embperl/trunk/test/html/escutf8.htm?rev=331995&r1=331994&r2=331995&view=diff
==============================================================================
--- perl/embperl/trunk/test/html/escutf8.htm (original)
+++ perl/embperl/trunk/test/html/escutf8.htm Wed Nov 9 00:11:00 2005
@@ -26,6 +26,9 @@
<input name="utf8">
<textarea name="utf8"></textarea>

+poststd: <input name="poststd">
+postutf8: <input name="postutf8">
+
$escmode = 8 ;
[- $escmode = 8 ; -]
abc!"$%&()<>=äöüÄÖÜß -> [+ $fdat{test} +]
@@ -61,6 +64,9 @@
<input name="utf8">
<textarea name="utf8"></textarea>

+poststd: <input name="poststd">
+postutf8: <input name="postutf8">
+
$escmode = 8 ;
[- $escmode = 8 ; -]
abc!"$%&()<>=äöüÄÖÜß -> [+ $fdat{test} +]
@@ -95,6 +101,9 @@
abc!"$%&()<>=äöüÄÖÜß -> [+ $fdat{utf8} +]
<input name="utf8">
<textarea name="utf8"></textarea>
+
+poststd: <input name="poststd">
+postutf8: <input name="postutf8">

$escmode = 8 ;
[- $escmode = 8 ; -]



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe [at] perl
For additional commands, e-mail: embperl-cvs-help [at] perl

ModPerl embperl-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.