Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4389373

8-bit characters from applet <param> tags get sign-extended

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: maT54148 Date: 11/14/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)


        Subcategory: java-plugin

      Applet <param> tags with 8-bit characters have their values sign-extended
      when queried from the applet (netscape 4.76, with java-plugin). This is
      different from "appletviewer" or "netscape" with netscape's builtin java
      implementation (both zero extend 8-bit chars, giving proper unicode encoded
      param strings).

      Example:
      % cat applet.html
      <html>
      <body>
      <applet width="50" height="50" code="applet">
        <param name="param1" value="?">
      </applet>
      </body>
      </html>

      % cat applet.java
      public class applet extends java.applet.Applet {
              public void init() {
                      String param1 = getParameter("param1");
                      System.out.println("param1=" + param1);
                      System.out.println("param1[0]=" + (int) param1.charAt(0));
              }
      }


      In appletviewer or with netscape's jvm, this simple applet prints:
      param1=?
      param1[0]=228

      Using the jdk1.3.0 java plug-in from netscape-4.76, this applet prints
      param1=?
      param1[0]=65508

      Note how the param1 parameter was sign-extended (0t228 = 0xe4, 0t65508 = 0xffe4)
      (Review ID: 111855)
      ======================================================================

            djayaramsunw Devananda Jayaraman (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: