We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting Word to Html : encoding issue

I am using Aspose.Words for Java for converting word document to html.

I am facing a problem while doing that. Any word within double quotes in the document does not show up correctly.

eg : cats have four "legs" to walk

generated html : cats have four “legs‿ to walk

This happens when saving the document using the default encoding which is UTF-8 as follows:

document.save(outputHtmlStream, SaveFormat.HTML);

I have refered the following thread on the forum


and have also tried changing to the US-ASCII encoding but it has its own problems. It shows up other characters which are not there as part of the word document.

Is there a way to get the proper html with correct encoding?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I can’t reproduce this issue on my side. Could you please attach your document for testing? Note I used the latest version of Aspose.Words for java (v 2.4.2) for testing.

Problem with encoding of output HTML was solved in .NET version of Aspose.Words by adding new SaveOption that allows setting output encoding. This ability will be ported to java version in the next release (within month or two).

Best regards.

I am seeing exactly the same issue. Has any resolution been found?

In my test, I’ve surrounded selected words with double-quotes. The code used looks like this:

SaveOptions saveOptions = document.getSaveOptions();

System.out.println(“Set document save options.”);

try {
document.save(byteArrayOutputStream, SaveFormat.HTML);
} catch (Exception e) {
System.out.println(“Unable to save docuemnt.”);
throw new Exception(“Unable to save document”, e);

One of the resulting generated snipets:

In the “science experiment” shown here, it was determined that when placing cold and hot water into water at room temperature, cold water sank, while the hot water rose to the top.

Based on this result, which of the responses below accurately completes the sentence?

Note the double-quotes around the words “science experiment”. I would have expected to see something like " replacing the double-quotes.

Hi Dave,

Thanks for your request. I just answered your question here: <A href="https://forum.aspose.com/t/76887</A></P> <P>Best regards,</P>