You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Roberto Viana <rv...@agency.com> on 2001/03/27 10:57:58 UTC

Troubles when using different encoding charsets in cocoon 1.8x

Hi there,

A couple of days ago I sent a question about "How to configure cocoon to use
multiple encoding charsets".
I got some good answers to my question, unfortunately I still can't display
russian characters in cocoon.

I created multiple formatter instances of the cocoon.properties for each of
the encoding types, like this(in the cocoon.properties);

# formatters
###############################

formatter.type.text/xhtml        =
org.apache.cocoon.formatter.XHTMLFormatter
formatter.type.text/xhtml/KOI8-R =
org.apache.cocoon.formatter.XHTMLFormatter

# XHTML 1.0 (strict)
formatter.text/xhtml.doctype-public = -//W3C//DTD XHTML 1.0 Strict//EN
formatter.text/xhtml.doctype-system =
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
#formatter.text/xhtml.doctype-system = DTD/xhtml1-strict.dtd
#formatter.text/xhtml.doctype-system = xhtml1-strict.dtd
formatter.text/xhtml.MIME-type = text/html
formatter.text/xhtml.encoding = UTF-8

# XHTML 1.0 (russian)
formatter.text/xhtml/KOI8-R.doctype-public = -//W3C//DTD XHTML 1.0
Strict//EN
formatter.text/xhtml/KOI8-R.doctype-system =
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
formatter.text/xhtml/KOI8-R.MIME-type = text/html
#formatter.text/xhtml/KOI8-R.encoding = windows-1251
formatter.text/xhtml/KOI8-R.encoding = KOI8-R

Then I have a XSL that I include in other XSL's to choose the appropriate
formatter instance;


<xsl:stylesheet version="1.0" 
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:xsp="http://www.apache.org/1999/XSP/Core"
		xmlns:util="http://www.apache.org/1999/XSP/Util">

<xsl:template match="content" mode="charset">
<xsl:choose>
	<xsl:when test="@language='ru'">
		<xsl:processing-instruction
name="cocoon-format">type="text/xhtml/KOI8-R"</xsl:processing-instruction>
	</xsl:when>
	<xsl:otherwise>
		<xsl:processing-instruction
name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
	</xsl:otherwise>
</xsl:choose>

</xsl:template>
</xsl:stylesheet>

This code make the browser aware of the type of encoding being used, however
the characters displayed are not correct.
What I discovered yesterday is that when I set the
PI(processing-instruction)to type="test/xml" it works but when I set the
PI(processing-instruction)to type="text/xhtml/KOI8-R" it doesn't works!!!

If you have successfully implemented this before, please send me some
feedback/ideas about what can be the problem here(have 2 days already
working on this issue :-( ).

Roberto.




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>