Cannot render special HTML character with Java

I'm pretty sure this is a general Swing issue, please don't ignore this because I reference JavaHelp. When using JavaHelp and French as the displayed language, I'm having problems displaying the œ character (HTML entity &# 156;). Below I've included a sample HTML file, based on what my actual files looks like, which should demonstrate the problem. If I use a browser, or even Notepad, to open this file, the character displays just fine. However, in my JavaHelp popup (which uses Swings HTML renderer under the covers if I am not mistaken), all I get is a box. I've tried using the actual character and the HTML entity, but to no avail. Comments/suggestions/pointers would be greatly welcome!
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
        <style>
            li {padding-bottom: 6px; padding-top: 6px;}
            body {font-family: Helvetica, Arial, sans-serif; } td {font-size: smaller;}
        </style>
    </head>
    <body alink="#ff0000" bgcolor="#ffffff" link="#0000ff" text="#000000" vlink="#800080">
        &#156;
    </body>
</html>Thanks,
Jamie

all I get is a boxSo JavaHelp is rendering it as a single character and not as the six characters &, #, 1, 5, 6, and semicolon. So far, so good. But it appears that the font JavaHelp is using is unable to render that character correctly, so you get a box.
Can you control the fonts that JavaHelp uses? If so, try using a font that can render the &#156; character.
PC&#178;

Similar Messages

  • How to create dom treeof html page with java

    hi, all
    i met with a problem how to create dom tree of html page wih jave, that is, given a html page, how to create a dom tree of this page with java?
    thanks in advance.
    regards
    richard

    but i m using this code to create node in html file
    HTMLLIElement li = (HTMLLIElement)appHTML.createElement("LI");
    Text txt = appHTML.createTextNode(name);
    li.appendChild(txt);
    appHTML.getElementById("name").appendChild(li);
    this will display all name value which is coming from database,
    and i want to assign a hyperlink to it,
    I have id with name also so I thought that using id i will
    create javascript like
    function popup(id)
         if(id==1)
              var n1 = window.open("../list/name1.html");
         if(id==2)
              var n1 = window.open("../list/name2.html");
    this way i want to popup particular file if i can pass id value in this function
    so want hyperlink like
    name

  • Get html data with java

    Ok say I want to get some kind of data from a html page? How could it be done? Is this possible with java, or do I have to use some kind of scripting language?

    It looks like what you might be looking for is a method of getting HTTP, not HTML, data. HTML is simply text and can therefore be retrieved any way that a File could be retrieved (using a FileReader/FileWriter). HTTP, on the other hand, is the protocol that we use the most when viewing websites.
    If you're looking to make HTTP request, you may want to look into something like java.net.HttpURLConnection. Try searching these forums for HTTP, not html.

  • HTML splitting with java

    I'm currently working on a program that fetches posts from a blog and then presents these posts on a webpage using wicket. The webpage cannot require any user interaction and all content must be visible on the same page (without the use of autoscroll etc.) To be able to fit two or three posts on the same page I have to show only the beginning of each post (and whoever wants to read further will have to go to the blog). I want to split the posts using the following method:
    public void insertPosts(int visiblePosts, int visibleChars);where visiblePosts represents the number of visible posts and visibleChars is the visible characters per post.
    Each post is a html formatted string and I am a little lost on how to get started with this. For instance, characters inside a tag should not be counted, all opened tags must be closed, paragraph tags that does not add any characters, but still consumes space on the page etc. Can anyone get me started? Maybe something similar already exists?

    AndrewThompson64: This will not be a concern. The webserver runs locally on a single computer where we can adjust the numbers of visible post and characters to fit the screen resolution.
    sztyopek: This might be the way to go, although i cannot add JEditorPanes. It must be strings. They are inserted into the document like this:
    Index.java
    page.add(new Label(("content", post.getContent()).setEscapeModelStrings(false)if setEscapeModelStrings is true the html tags is interpreted as part of the content and the whole string is printed to the page as is.
    Index.html
    <div wicket:id="content" />I'll have a look at HTMLDocument. If anyone else has any other suggestions or want to elaborate more on this, please do so! :)

  • ERROR USING HTML textarea with Java String

    I have a form in HTML that has a textarea for input messages.
    When user press submit, a java servlet gets the information and stores it in a Database as a String.
    Later, I have a JSP thata retrieves that information from the database and put it as the value propertie of another textarea in the page so user can modify it if wanted, but I am having a hard time finding how to do so , because when I do the line:
    <textarea .....bla bla.... value=
    <%=some_string%>
    .....bla >
    and the some_string has more than one line ( e.g "\n" or "\r" caracteres ), I got an error when displaying the page. Can anyone help me with that please ???
    Thanks.

    here's my codes again for reference. hope it helps to rectify the matter
    // edit.jsp
    String search = (String)request.getParameter("txtSearch");
    String parameter = (String)"%"+search+"%";
    String sSQL = "select * from tblArticle where Title LIKE '"+parameter+"'";
    <%
    try {
    while(Rs.next()) {
    %>
    <tr>
    <td width="16%" height="157" align="center">Article:</td>
    <td width="88%" height="157"><textarea rows="15" name="txtArt" cols="86" value="<%= txtArt %>"></textarea></td>
    </tr>
    </table>
    <%
    // .....

  • How to reduce size of html files with JAVA?

    We have html files full of tab char, carriage return, blank space between tags etc. We need to reduce the size of this files.
    HTML files are automatic generated by an engine and we cannot operate on it.
    Those files are in a solaris environment and we need to launch or to schedule something that can clean the files in this environment. The only tools we found are for Win environment so we toughth to make some java classes that parse HTML and clean the files.
    Does anyone know how some tool or the way to clean a file in java?
    Thank You

    Something like this can reduce the number of spaces between tags in the body of the file:public static final String readTextFromFile (File f)
            StringBuffer fileText = new StringBuffer();
            if (f != null && f.exists() && f.isFile())
                try
                    FileReader fr = new FileReader(f);
                    BufferedReader br = new BufferedReader(fr);
                    String s;
                    char c;
                    boolean inTag = false;
                    boolean lastWasSpace = false; // so we don't have a million spaces in a row
                    boolean inBody = false;
                    while ((s = br.readLine()) != null)
                        s += " ";
                        s = searchReplace(s, " ", " ");
                        if (!inBody)
                            int bodyStartPos = s.indexOf("<body");
                            // if not in body yet, reloop
                            if (bodyStartPos == -1)
                                continue;
                            // start it off
                            else
                                inBody = true;
                                s = s.substring(bodyStartPos);
                        for (int i = 0; i < s.length(); i++)
                            c = s.charAt(i);
                            if (c == '>')
                                inTag = false;
                            else if (c == '<')
                                inTag = true;
                            else if (!inTag)
                                if (!(c == ' ' && lastWasSpace))
                                    fileText.append(c);
                                if (c == ' ')
                                    lastWasSpace = true;
                                else
                                    lastWasSpace = false;
                    if (br != null)
                        br.close();
                    if (fr != null)
                        fr.close();
                catch (Exception e)
                    System.err.println(f + ": Error reading file");
            return fileText.toString();
        }

  • Help on processing french character with java String class

    hi all
    i have a question about processing french character. i have a file that contains french characters such as �, when it is read in and assigned to a string variable, it becomes &#9577;, how can i preserver the french characters? thanks

    The following interfaces exist in the above
    - The database
    - Reading the data from the database
    - Writing the data using println.
    - Reading data from a file.
    You need to identifier exactly what data exists
    at each interface.the data in xml contains french characters. and i need to store it in the sql server. somehow when it was read in, it was changed to something else.
    Internally java keeps characters in unicode so you can
    definitely get that character into unicode. However
    just because it is in java does not mean that
    println() is going to display it. Because when
    println() runs it converts the unicode into a
    character set (which is determined by the computer,
    OS, and other factors.)
    So the first step is to determine the numeric value of
    the character in all of the interfaces above. For
    example it doesn't matter what you do in java if the
    character in the database is not what you think it is.
    Or if the driver converts it when it gets read.
    are u saying that i need to get the numeric value of the character first? how would i save it in the DB?

  • Cannot open zip file generated with java

    Hello everybody !
    I work on a web application ( servlet, JSP... ).
    I generate a zip file containing only one file corresponding to a JSP page but when I try to open it thanks to Winzip 8.0, I have the following message :
    Error : invalid compressed data to inflate.
    The zipped file is not empty, does anybody know what is the problem, here is the source code of my servlet :
    public void trt (HttpServletRequest req, HttpServletResponse res)     throws ServletException, IOException
    URL l_JspPage;
    String temp;
    ByteArrayOutputStream l_ByteArrayOutputStream = new ByteArrayOutputStream();
    ZipOutputStream l_ZipOutputStream = new ZipOutputStream(l_ByteArrayOutputStream);
    l_ZipOutputStream.setMethod(ZipOutputStream.DEFLATED);
    ServletOutputStream out = res.getOutputStream();
    ServletContext servletContext = getServletContext();
    if ((temp=req.getParameter("url"))!=null)
    try
    l_JspPage = new URL(temp);
    DataInputStream l_DataInputStream = new DataInputStream(l_JspPage.openStream());
    int l_iBufferSize = l_DataInputStream.available();
    byte l_byJspPageData[] = new byte[l_iBufferSize];
    l_DataInputStream.read(l_byJspPageData, 0, l_iBufferSize);
    l_ZipOutputStream.putNextEntry(new ZipEntry("file.html"));
    l_ZipOutputStream.write(l_byJspPageData,0,l_iBufferSize);
    l_ZipOutputStream.closeEntry();
    l_ZipOutputStream.finish();
    String zip=l_ByteArrayOutputStream.toString();
    res.setContentType("application/zip");
    res.setHeader("Content-Disposition","inline; filename=output.zip;");
    out.println(zip);
    out.flush();
    Thanks for your help.

    Your code is somewhat obscure, but it appears that you are writing a zip file to a byte array, converting the byte array to a string, and writing the string to "out" - whatever that is.
    I'm not sure why you are going through all this, but in any case the string conversion is probably a wrong step. Zipping results in binary data, and string conversion will probably result in changes to the binary values.

  • I cannot select a single character

    I'm running Pages 5.2.2 on MacOS 10.9.4 on a 2011 MacBook Pro. The problem is I cannot select a single character with my Magic Mouse. If I try to drag over a single letter to select it, the cursor is positioned either before or after the letter. I can select and format groups of two or more characters, but not just one. It works with the trackpad though. I can select single characters with the mouse in other apps such as Word.

    While we all have MacBooks in this forum most of us don’t run Mountain Lion. There's a Mountain Lion Support Community where everybody has Mountain Lion. You should also post this question there to increase your chances of getting an answer. https://discussions.apple.com/community/mac_os/os_x_mountain_lion

  • Printing HTML Docs with JPS ???

    Hello!
    How can I print a HTML-File with Java Printing Service (not the source, but the view of it) ???
    Some experience???
    kind regards
    pedros25

    I'm currently trying to do just that. My problem is
    that in order to get a lengthy HTML document to
    print, you have to have an object that
    implements the Pageable interface. The two methods
    I'm having trouble with are
    getNumberOfPages()
    This returns the number of pages in the Print job.
    How do I calculate the number of pages in an HTML
    document?
    getPrintable(int pageIndex)
    For this part, I just rerturn a reference to the JScrollPane which contains the JEditorPane. However,
    I also have to get it to scroll to the appropriate
    page. Right now I'm using the following:
    public void goPage(int pageIndex)
    int block = pane.getScrollableBlockIncrement(scroller.getViewport().getViewRect() ,SwingConstants.VERTICAL,1);
    int newVal = block*pageIndex;
    //scroller.getVerticalScrollBar().setValue(newVal);
    scroller.getViewport().scrollRectToVisible(new Rectangle(0,newVal,this.getSize().width,block));
    But this seems to be causing a few lines to be skipped
    between each page. Any ideas on how to implement the
    pageable interface for a JScrollPane that contains a
    JEditorPane which contains an HTMLDocument?

  • WPC Cannot render container with special characters

    Hi
    My portal generates error: "Cannot render container : An error occurred while loading the document from the resource content" when i Finish editing my page. 
    The special characters that I use are words with accents only with capital letters (used in spanish like Á, É, Í, Ó, Ú)
    Any ideas on what could be causing this?
    Portal 7.01 SP06
    Jose Mercado

    I solve my problem, with  Sap Help.
    They send me: check the charset settings on client & J2EE as follows
    On Client side: Internet Explorer menu > Tools -> Internet Options -> Advanced
    please select 'Always send URLs as UTF-8'.
    On J2EE engine:  . It is important to check the parameter exists for all server nodes in config tool
    -Dhtmlb.useUTF8=X
    -Dfile.encoding=ISO-8859-1
    -Dfile.encoding=UTF8

  • Need special encoded characters in an Email subject with java 1.3.1_02

    I need to find a way to construct an Email through java with Subject lines built using characters from various Asian encodings. Such as Shift-JIS, Chinese Big5, etc.
    These encodings cannot be in UTF-8 format and must remain in the native character set.
    For testing I have an HTML file constructed using a single line of text with Shift-JIS characters. This file shows properly in web browsers under the Shift-JIS encoding view, and when used to create the body of an email it works perfectly through the DataHandler. However, I cannot get any java Reader to pull the same stream of characters into the Subject of the email. The Subject is always garbage no matter what I do.
    Here is a small code sample with the relevant lines:
    Session session = Session.getDefaultInstance(System.getProperties(), null);
    MimeMessage reSend = new MimeMessage(session);
    Transport ship = session.getTransport();
    BufferedReader s = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\JavaPrograms\\Converted\\JISConv.html"), "SJIS"));
    String resub = s.readLine();
    s.close();
    reSend.setSubject(resub);
    DataHandler collect = new DataHandler(new FileDataSource("C:\\JavaPrograms\\Converted\\JISConv.html"));
    reSend.setDataHandler(collect);
    ship.send(reSend);If I use the "SJIS" encoding in the InputStreamReader above, all characters are shown as "?". If I delete it entirely and use the system default, I get half of the characters and the rest are garbage. I can generate either of those results using various other Japanese and Western encoding definitions.
    I have tried using the above code, also DataHandlers for the Subject, FileReader directly to a String, ByteArrayInputStreams, and StringBuffers. So far everything I try ends up at the same result.
    Can anyone help me out? I really need this to work. If I can get this one encoding to work, then I should be able to program case switches for the other encodings.
    Thanks kindly!
    Kurt Jackson

    First this is an issue with javamail and not with java.
    What makes you think that the mime standard allows what you want to do?
    Both of your 'tests' have been done using alternatives which do support alternative encodings.
    These encodings cannot be in UTF-8 format and must remain in the native character set.That seems rather unlikely to me. Email is transported using one encoding. Certainly SMTP uses only ascii. So what ever you put in there is going to be ASCII no matter what you do to it. I suppose something at the end might try to read it using an alternative encoding but then what happens when someone really wants to send those ASCII characters?
    Mime, I believe, is built on SMTP. And the subject line is still SMTP and thus ASCII.
    Here is one link that covers mime (you might want to check the backing references though.)
    http://www.mindspring.com/~mgrand/mime.html
    I believe there is some sort of official or unofficial standard for doing what you want. I would suggest that you start by getting that first. I would suspect JavaMail doesn't support it.
    Once you have a standard to follow you have the following choices..
    - Modify JavaMail directly to support this (this then becomes a non-distributable solution.)
    - Extend JavaMail do support this. This might or might not be possible.
    - Write your own implementation (don't use JavaMail.)
    - Find another solution from another source that already implements this.

  • How to render HTML files in Java?

    I've read a bit about rendering HTML files using JEditorPane, but been told it's quite limited, and doesn't handle many events other than Hyperlinks stuff...
    I heard that Java bean has a slight more advanced HTML renderer, is that right?
    The thing is that I'm hoping to create a simple (static) HTML editor using Java, but need something to render the HTML file...and I need more event handleling, e.g. mouse click on what element (text, image or table) of the rendered HTML file.
    Can someone please give me some ideas?

    If you just need to display the HTML page with link support, you can use the JEditorPane with the content type as text/html. Look up the Java Tutorial on this site (http://java.sun.com/docs/books/tutorial/uiswing/components/text.html) and the API docs for details on how to use it.

  • Inserting a special character with GREP styles

    Hi.
    I wanna define a GREP style that makes this: if I write Bluetooth I wanna that a registered trademark is added at the end of the word but with superscript format. Is it possible?
    Thanks in advance.

    No, GREP styles only apply formatting, they cannot insert characters. Use a regular find & change to do so.
    (There is a thinking-outside-of-the-box solution. If you have access to a font creating utility, you can create a character 'h' with TM attached to it. Then you can use a GREP style to automatically apply this custom font to just the 'h' of 'Bluetooth'. See http://indesignsecrets.com/insert-a-special-character-with-grep-styles.php.)

  • A tree-view in HTML page with nodes generated with java script in run time is not visible in the UI Automation Tree. Need Help

    I have a HTML page with an IFrame. Inside the Iframe there is a table with a tree view
    <iframe>
    <table>
    <tr>
    <td>
    <treeview id="tv1"></treeview>
    </td>
    </tr>
    </table>
    </iframe>
    In UIA, i am able to traverse till the tree view but not able to see it.
    I have used the TreeWalker.RawViewWalker Field to traverse the node from the desktop Automation.RootElement. 
    I tried to use AutomationElement.FromPoint method to check whether i am able to get that element. Fortunately i was able to get the automation element. 
    i tried to get the path to root element from the node element using the TreeWalker.RawViewWalker. I was able to get the parent path to the root element.
    But trying the reverse way like navigating from root element to tree node, was not getting the element for me. 
    Please help me with suggestions or inputs to resolve this issue. 

    Thanks Bernard,
    It works fine with JInitiator but not working with
    the JPI. For JPI what settings I need to do ??hi TKARIM and Bernard, i am having similar problem even with the Bernard's recommended setup. could you post the webutiljini.htm (i presume you are using config=test) ?
    i am actually using jinitiator 1.3.1.28 with Oracle HTTP Server of OAS 10gR2) calling Forms Server 6i (f60cgi). After setting up according to Bernard's recommended setup steps, the java console showed that it loaded the icon jar file when it could not read the form, but it skipped the loading of the icon jar file once it read and started the form. How do we specify in the form to pick up the icon from the jar file instead from a directory ? Or do we need to specify ? Any ideas ?
    Thx and Regards
    dkklau

Maybe you are looking for

  • Scatter Plot will not start on requested date

    Hi, I am trying to make a very simple scatter plot in Numbers for Mac 3.1. I have created a table with two columns and 44 rows. one column is formatted to dates (year only), the other to numbers (3 decimal places). When I select the table, click on c

  • Gateway password isn't working

    I have a verizon G1100 router and I can't seem to access the gateway. The password wasn't changed to my knowledge and it from my researchit should either be "password" or "admin". If I can't get access is there any easy way to reset it without a lot

  • Customize buttons added to toolbar keep disappearing

    Steps to reproduce: 1. Menu -> Customize 2. Drag some of the extra icons to the top right toolbar (next to the menu icon) Now, some icons constantly keep disappearing. As a consequence, I need to re-add them quite regularly. Why are some icons simply

  • Adobe 2.0

    I just reformatted my hard drive and am trying to reinstall photshop elements 2.0 but after going through the prompts as part of the installation the window disappears and no installation is initiated. Any suggestions what I can do to get the softwar

  • HT201365 Please any one can help me ?

    My mam mini IPad stop working, when I try to reset it the system ask me to unlock it with Apple ID because "" find my iPad is turned on"" and I don't know the id that ben used. What I have to do?!