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

Soft hyphen displays a hyphen if the line is not broken in JLabel using HTML

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 6u17
    • client-libs

      FULL PRODUCT VERSION :
      Java 6 Standard Edition, Version 6 Update 17, Build 1.6.0_17-b04

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.0.6000]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Java 6 Standard Edition, Version 6 Update 17, Build 1.6.0_17-b04

      A DESCRIPTION OF THE PROBLEM :
      The W3C recommendation says: "Those browsers that interpret soft hyphens must observe the following semantics: If a line is broken at a soft hyphen, a hyphen character must be displayed at the end of the first line. If a line is not broken at a soft hyphen, the user agent must not display a hyphen character."

      Using a JLabel component with HTML content and including ­ in the text a hyphen character will be shown always - both if the line line is broken at that point or not.

      I've tested it with the HtmlDemo program in the Java Tutorial,
      http://java.sun.com/docs/books/tutorialJWS/uiswing/components/ex6//HtmlDemo.jnlp

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Download the demo http://java.sun.com/docs/books/tutorialJWS/uiswing/components/ex6//HtmlDemo.jnlp

      Replace the text in the left are with:

      <html>Soft&#173;hyphen</html>

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      On the right side, in the JLabel should stay:

          Softhyphen
      ACTUAL -
      The JLabel displays

           Soft-hyphen

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Source is available an Sun - at

      http://java.sun.com/docs/books/tutorial/uiswing/examples/components/HtmlDemoProject/src/components/HtmlDemo.java
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I have not found any simple solutions.

            peterz Peter Zhelezniakov
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: