try {
Metadata metadata = new Metadata();
metadata.set(Metadata.CONTENT_TYPE, "text/html");
metadata.set(Metadata.CONTENT_ENCODING, InternalValueFactory.DEFAULT_ENCODING);
TextExtractionService textExtractor = (TextExtractionService) SpringContextSingleton.getBean("org.jahia.services.textextraction.TextExtractionService");
internalValue = textExtractor.parse(new ByteArrayInputStream(((String) internalValue)
.getBytes(InternalValueFactory.DEFAULT_ENCODING)), metadata);
} catch (Exception e) {
internalValue = StringEscapeUtils.unescapeHtml((String) internalValue);
}
}