Re: UTF-16 encoded HTML




"Stephan Zimmermann" <s.zimmermann@xxxxxxxxxxxxxxxx> wrote in message
news:df4ak2$31n$05$1@xxxxxxxxxxxxxxxxxxxx
> Hi all,
> I have a HTML file, encoded in UTF-16, which my webbrowsers can display
> very
> well. But when I load the same URL into JEditorPane, I only see some ugly
> boxes and other trash.
> <code>
> JEditorPane ep = new JEditorPane(fileURL);
> </code>
>
> I also tried to read the content of the file over an FileInputStream,
> which
> leads to a nice view of the HTML code.
> <code>
> InputStreamReader in = new InputStreamReader(new
> FileInputStream(fileURL.getFile()),"UTF-16");
> ep.read(in,"text/html; charset=UTF-16");
> </code>
>
> Is there a way to display a UTF-16 encoded HTML file? Or is there another
> (easy) way to show (formatted) Information in multiple languages without
> using different encodings?

Did you try reading it via the InputStreamReader (as per the second
example), and then passing the string read-in to the JEditorPane?

- Oliver


.



Relevant Pages

  • Re: simple webrowser
    ... > the method setPageof jeditorpane but I can't get it working. ... > that fact that the html file i am trying to load is on my hard drive ... Go to groups.google.com and search for "jeditorpane problem display ... html" to see some of the pain in action. ...
    (comp.lang.java.help)
  • UTF-16 encoded HTML
    ... But when I load the same URL into JEditorPane, ... Is there a way to display a UTF-16 encoded HTML file? ...
    (comp.lang.java.gui)
  • Re: UTF-16 encoded HTML
    ... But when I load the same URL into JEditorPane, ... Is there a way to display a UTF-16 encoded HTML file? ...
    (comp.lang.java.gui)
  • Re: html entities in JEditorPane
    ... > I've tried to read and display a html file in a JEditorPane. ... Check a decent HTML reference. ...
    (comp.lang.java.programmer)
  • Re: forcing ie to save the contents of the html instead of displaying it
    ... >I have an html file where I display name,address,zip. ... I know I can set it up as a txt file and let them download it ... to do this if *they* want it to without any special work on your part? ...
    (comp.infosystems.www.authoring.html)