At Wed, 16 May 2001 09:29:05 -0400 (EDT),
Shawn Bayern wrote:
> 
> Thanks for bringing up this point.  I didn't see the actual patch
> attached; if you could forward it to the list, I'll take a look.

Oops, sure. 

Please take following patch.

regards.
----------------------------
 ^^     Takashi Okamoto <[EMAIL PROTECTED]>
= ..=   Debian Developer
 -o-    Key fingerprint:
            8B37 1FE6 76B2 7BA6 D59A  9BF7 E7F4 46C8 5293 6E17




diff -uNr input.orig/conf/taglib.tld input/conf/taglib.tld
--- input.orig/conf/taglib.tld  Wed May 16 19:27:47 2001
+++ input/conf/taglib.tld       Wed May 16 19:18:04 2001
@@ -37,6 +37,11 @@
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
     </attribute>
+    <attribute>
+       <name>encoding</name>
+       <required>false</required>
+       <rtexprvalue>true</rtexprvalue>
+    </attribute>
   </tag>
 
   <tag>
@@ -87,6 +92,11 @@
     </attribute>
     <attribute>
        <name>attributes</name>
+       <required>false</required>
+       <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+       <name>encoding</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
     </attribute>
diff -uNr input.orig/src/org/apache/taglibs/input/Text.java 
input/src/org/apache/taglibs/input/Text.java
--- input.orig/src/org/apache/taglibs/input/Text.java   Wed May 16 19:27:47 2001
+++ input/src/org/apache/taglibs/input/Text.java        Wed May 16 19:18:27 2001
@@ -75,6 +75,7 @@
     private String name;               // name of the text field
     private String dVal;               // default value if none is found
     private Map attributes;            // attributes of the <input> element
+    private String encoding = null;     // character encoding
 
     public void setName(String x) {
        name = x;
@@ -88,6 +89,10 @@
        dVal = x;
     }
 
+    public void setEncoding(String enc) {
+       encoding = enc;
+    }
+
     public int doStartTag() throws JspException {
        try {
             // sanity check
@@ -98,6 +103,10 @@
            ServletRequest req = pageContext.getRequest();
            JspWriter out = pageContext.getOut();
 
+           if (encoding==null) {
+               encoding = "iso-8859-1";
+           } 
+
            // start building up the tag
            out.println();
            out.println("<input ");
@@ -112,8 +121,8 @@
             * use the default value if it's not
             */
            if (req.getParameter(name) != null)
-               out.println("    value=\"" 
-                   + Util.quote(req.getParameter(name)) + "\"");
+               /* decode parameter by response encoding */
+               out.println("    value=\"" + Util.quote(new 
+String(req.getParameter(name).getBytes("iso-8859-1"), encoding)) + "\"");
            else if (dVal != null)
                out.println("    value=\"" + Util.quote(dVal) + "\"");
 
diff -uNr input.orig/src/org/apache/taglibs/input/TextArea.java 
input/src/org/apache/taglibs/input/TextArea.java
--- input.orig/src/org/apache/taglibs/input/TextArea.java       Wed May 16 19:27:47 
2001
+++ input/src/org/apache/taglibs/input/TextArea.java    Wed May 16 19:18:47 2001
@@ -75,6 +75,7 @@
     private String name;               // name of the textarea
     private String dVal;               // default value if none is found
     private Map attributes;            // attributes of the <textarea> element
+    private String encoding = null;     // character encoding
 
     public void setName(String x) {
        name = x;
@@ -88,6 +89,10 @@
        dVal = x;
     }
 
+    public void setEncoding(String enc) {
+       encoding = enc;
+    }
+
     public int doStartTag() throws JspException {
        try {
             // sanity check
@@ -98,6 +103,10 @@
            ServletRequest req = pageContext.getRequest();
            JspWriter out = pageContext.getOut();
 
+           if (encoding==null) {
+               encoding = "iso-8859-1";
+           } 
+
            // start building up the tag
            out.println();
            out.println("<textarea ");
@@ -114,7 +123,8 @@
             * use the default value if it's not
             */
            if (req.getParameter(name) != null)
-               out.print(Util.quote(req.getParameter(name)));
+               /* decode parameter by response encoding */
+               out.print(Util.quote(new 
+String(req.getParameter(name).getBytes("iso-8859-1"), encoding)));
            else if (dVal != null)
                out.print(Util.quote(dVal));
 

Reply via email to