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

Trademark character not displayed in JEditorPane or JTextPane

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.3.1, 1.3.1_06, 1.4.1_02, 1.4.2
    • client-libs
    • tiger
    • x86
    • windows_2000, windows_xp



      Name: jk109818 Date: 06/11/2003


      FULL PRODUCT VERSION :
      java version "1.3.1_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_07-b02)
      Java HotSpot(TM) Client VM (build 1.3.1_07-b02, mixed mode)

      java version "1.3.1_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_06-b01)
      Java HotSpot(TM) Client VM (build 1.3.1_06-b01, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]
      and
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The Trademark symbol ™, aka ™ do not render in JTextPane or JEditorPane when the content type is set to HTML setContent("text/html");

      In JLabel, or JTextArea ™ will cause a superscripted (TM) to appear, putting the same HTML content into a JTextPane will cause an empty square to appear.

      The Copyright symbol and Registered Trademark © and ® respectively do render in HTML content set to a JTextPane.

      Example HTML:
      <html>
      <body>
      This is a copyright symbol: &#169;
      This is a Registered TradeMark: &#174;
      This is a Trademark Symbol: &#153;
      </body>
      </html>

      Applying this text to a JTextArea will correctly render the symbols, JLabel will as well. However when calling JTextArea.setText() or using this HTML in another file and using setPage(URL) the TradeMark symbol will not be displayed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Save this to test.html:
      <html>
      <body>
      This is a copyright symbol: &#169;
      This is a Registered TradeMark: &#174;
      This is a Trademark Symbol: &#153;
      </body>
      </html>


      1) Create a simple JTextPane/JEditorPane to display on screen
      2) setPage on component in 1) to be the 'test.html'
      or
      2b) set the text of component in 1) using setText() with a String having the value of test.html's content.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect the (TM) symbol to appear wherever &#153; is used. It appears in JLabel and JTextField and JTextArea but for some reason JEditorPane and it's decendants are unable to render this symbol.
      ACTUAL -
      You see an empty square, the same square you see if the character does not exist for a particular font. However in this case it is wrong because it exists as shown by JLabel and JTextField

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      JFrame frame=new JFrame();
      JTextPane pane=new JTextPane();
      pane.setContentType("text/html);
      pane.setText("<html><body>This is a copyright symbol: &#169;This is a Registered TradeMark: &#174;This is a Trademark Symbol: &#153;</body></html>");

      frame.getContentPane().add(pane);
      frame.setSize(300,300);
      frame.show();


      Replace with JTextArea to see difference.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      <sup><small><tt>TM</tt></small></sup> should be used instead of &#153;
      (Review ID: 187694)
      ======================================================================

            naasunw Naa Naa (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: