Hi Tobia,

1) In your formtemplate set the attribute enctype to "multipart/form-data" 

<ft:form-template enctype="multipart/form-data"/>


2) In your pipeline, use:

    <map:act type="set-header">
      <map:parameter name="Content-Type" value="text/html; charset=utf-8"/>
    </map:act>


3) In your cocoon web.xml specify:

    <init-param>
      <param-name>container-encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>

    <init-param>
      <param-name>form-encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>



I think this did the trick with our applications.

Joost

-----Oorspronkelijk bericht-----
Van: Tobia [mailto:[EMAIL PROTECTED] 
Verzonden: Tuesday, January 30, 2007 1:38 PM
Aan: users@cocoon.apache.org
Onderwerp: Sending mail from flowscript: encoding problems

I have a flowscript that handles a simple contact form, sending an email for 
each successful submit:


var form = new Form('cocoon:/contact.form')
form.showForm('contact.jx')
var fields = getFormFields(form)

var m = cocoon.getComponent(Packages.org.apache.cocoon.mail.MailSender.ROLE)
m.setSmtpHost('mail.whatever.com')
m.setFrom('"' + fields.name + '" <' + fields.email + '>')
m.setTo('[EMAIL PROTECTED]')
m.setSubject(fields.subject)
m.setBody('Web message:\n\n' + fields.message)
m.send()


The problem is that non-ASCII characters get mangled somewhere in the process.

Typing "à/è/ì/ò/ù" in the Message field results in an email with the text 
"à/è/ì/ò/ù", as if it was converted from ISO8859-1 to UTF-8 one time too 
much.

I tried adding  m.setCharset('utf-8')  to the flowscript, to no effect.

Any idea?


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to