As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
mimetypeService.getContentCharsetFinder().getCharset(streamSupportingMark, type)
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<bean id="charset.finder" class="org.alfresco.repo.content.encoding.ContentCharsetFinder"> <property name="defaultCharset"> <value>UTF-8</value> </property> <property name="mimetypeService"> <ref bean="mimetypeService"/> </property> <property name="charactersetFinders"> <list> <bean class="org.alfresco.encoding.GuessEncodingCharsetFinder" /> <bean class="org.alfresco.encoding.HtmlCharsetFinder" /> </list> </property> </bean>
/** * Worker method for implementations to override. All exceptions will be reported and * absorbed and <tt>null</tt> returned. * <p> * The interface contract is that the data buffer must not be altered in any way. * * @param buffer the buffer of data no bigger than the requested * {@linkplain #getBestBufferSize() best buffer size}. This can, * very efficiently, be turned into an <tt>InputStream</tt> using a * <tt>ByteArrayInputStream<tt>. * @return Returns the charset or <tt>null</tt> if an accurate conclusion * is not possible * @throws Exception Any exception, checked or not */ protected abstract Charset detectCharsetImpl(byte[] buffer) throws Exception;