You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Sparkes <pe...@didm.co.uk> on 2012/12/05 10:14:19 UTC

Binding Encoding with CForms/Dojo

C2.1.11

I have built a CForm application with a multilevel level recursive form based on:

http://cocoon.zones.apache.org/cocoon21/samples/blocks/forms/do-taskTree.flow

I am having problems getting it to work with UTF-8. http://cocoon.apache.org/2.2/1366_1_1.html states:

    "If you use CForms with ajax enabled, Cocoon will make use of dojo.io.bind() under the hood,
    which creates XMLHttpRequests that POST the form data to the server. Here Dojo decides the
    encoding by default, which does not match the browser's behaviour of using the charset defined
    in the META tag. But you can easily tell Dojo which formatting to use for all dojo.io.bind()
    calls, just include that in the top of your HTML pages, before dojo.js is included:

    <script>djConfig = { bindEncoding: "utf-8" };</script>

    You might already have other djConfig options, then simply add the bindEncoding property to the
    hash map."

When I put the script in the template.xml, UTF-8 encoding works, However the form's recursion stops 
working.

I tried putting the script in forms-samples-styling.xsl which has no effect, presumably its too late 
in the pipeline.

I assume that the application uses other djConfig options as the final html includes:

    <script  type="text/javascript">
           var djConfig = {};
            djConfig.isDebug = true;
           djConfig.locale = "en-GB";
           var cocoon;
           if (!cocoon)
             cocoon = {};
           cocoon.resourcesUri = "/_cocoon/resources";
      </script>

Help please:

      * How do I add the bindEncoding property to the hash map
      * or otherwise get UTF-8 encoding working

Peter