AnsweredAssumed Answered

character encoding problem with processTemplate?

Question asked by alrice on Oct 12, 2007
Latest reply on Nov 9, 2007 by kevinr
All, I am getting very productive with the webscripts environment. It's great. But i ran into an urgent and puzzing character encoding issue. Any suggestions greatly appreciated- thanks in advance. We have lots of foreign names in this application, so it's important to be able to support accented characters at least, and preferably in utf-8 unicode.

So i've been writing all my html forms in dreamweaver doctype xhtml, and
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The html forms have this type and charset specified also:
<form action="${url.serviceContext}/apply/postdoc08/edit?guest=true" 
I have a freemarker template applicant.xml.ftl that starts off
<?xml version="1.0" encoding="UTF-8"?>
So everything should be utf8 right? Indeed if i edit my source xml document with extended characters,  and save as UTF8 in TextEdit or, then all my html pages render the text just fine. Those freemarker templates are xhtml, utf-8, and are loading the xml file thusly:
<#assign dom=document.xmlNodeModel>
So that all works, but the problems arises when submitting the html form. The POST is received by a .js file, which applies the template and saves the result out to the repository. Here is where i think the character encoding is getting lost:
var tScriptSpace = companyhome.childByNamePath( gPathToScriptSpace  );
var tXMLTemplateNode = tScriptSpace.childByNamePath( gXMLTemplate );
var tArgs = formFieldsToArgsArray();
var tNewApplicantXMLStr = tApplicantXMLNode.processTemplate( tXMLTemplateNode, tArgs);
tApplicantXMLNode.content = tNewApplicantXMLStr;

My best guess is the call to processTemplate() is returning the wrong character encoding somehow? Not sure. Where have I gone wrong or is it a problem with processTemplate or something i have overlooked?