String logicHeader = "Héllô \"wörld\"! 1"; String initPage = "Héllô \"wörld\"! 2"; String exprInit = "Héllô \"wörld\"! 3"; // Use static to check exit-page logic the second time the page is called. static String exitPage = "Reload page please"; static String exprExit = "Reload page please"; exitPage = "Héllô \"wörld\"! 4"; exprExit = "Héllô \"wörld\"! 5"; Escaping of non-ASCII characters String logicContent = "Héllô \"wörld\"! 6"; String exprLogic = "Héllô \"wörld\"! 7";

For the various Java compilers which have been interfaced to Cocoon there is no unified method to tell the compiler the encoding of the Java source. Some compilers always assume UTF-8, others deduce it from the systems locale settings.

If there is a mismatch in the encodings, umlauts, accents, and other international characters will be mutilated in the output. In order to avoid this problem, XSP preprocesses all Java code and converts all non-ASCII characters to their \u1234 equivalent. Thus the Java compiler sees only ASCII characters, and the encoding becomes irrelevant (at least for character sets such as ISO-8859-1 which coincide which ASCII in the lower 128 characters).

Older Cocoon versions omitted to do the \u1234 conversion in some of the XSP contexts where Java string constants could be used.

In Cocoon 2.1.8 this is now fixed, as this test is supposed to show:

Context Result
xsp:page/xsp:logic logicHeader
xsp:page/xsp:init-page initPage
xsp:init-page/xsp:expr exprInit
xsp:page/xsp:exit-page exitPage
xsp:exit-page/xsp:expr exprExit
xsp:logic logicContent
xsp:logic/xsp:expr exprLogic
xsp:content/xsp:expr "Héllô \"wörld\"! 8"
xsp:expr "Héllô \"wörld\"! 9"
text() Héllô "wörld"! 10
attribute Héllô "wörld"! 11
xsp:attribute/text() Héllô "wörld"! 12
xsp:attribute/xsp:expr "Héllô \"wörld\"! 13"