<div>I've solved the problem setting "ignoreContext = True", then I populate the form in "updateWidgets" method with this code:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">


<div>for key in self.widgets.keys():</div><div>    value = getattr(self.context, key)</div><div>    if isinstance(value, str):</div><div>        value = unicode(value, "utf-8", errors="ignore")</div><div>


    if IDatetimeWidget.providedBy(self.widgets[key]):</div><div>        value = DateTimeParser().parse(value.strftime('%Y/%m/%d %H:%M'))</div><div>    self.widgets[key].value = value</div></blockquote><div><br></div>

<div><span style>Thanks again</span></div>
Umberto Calligaro <br><div><div><div><font color="#333333"><i><br></i></font></div></div></div>
<br><br><div class="gmail_quote">2012/3/28 Jean-Michel FRANCOIS <span dir="ltr"><<a href="mailto:toutpt@gmail.com" target="_blank">toutpt@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


z3c.form manage only unicode where archetype use only encoded strings. You have to encode data before do the save.<div><br clear="all">Regards / Cordialement,<br>JeanMichel FRANCOIS<div><a href="http://twitter.com/toutpt" target="_blank">Find me on Twitter</a> / <a href="http://twitter.com/toutpt_nantes" target="_blank">Retrouvez moi sur Twitter</a></div>




<div><br></div><br>
<br><br><div class="gmail_quote">Le 28 mars 2012 17:10, Umberto Calligaro <span dir="ltr"><<a href="mailto:u.calligaro@tecnoteca.com" target="_blank">u.calligaro@tecnoteca.com</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div>

<div>Hi,</div><div><br></div><div>I've a problem with unicode and z3c.form.</div><div>This is my scenario: I've a custom contet type (CT) based on Archetypes. <br>I've made a z3c.form Form to let anonymous users edit data and the form fields are generated from the interface of the CT. <br>






When I call the form with "ignoreContext=False" if there's a special character (something like "è","à", etc. ) in the description field, I get this error:</div><div><div>

<br></div><div>2012-03-28T16:00:31 ERROR Zope.SiteErrorLog 1332943231.380.770318914895 <a href="http://localhost:8080/.../my-contentype/@@add-update-event" style="color:rgb(17,85,204)" target="_blank">http://localhost:8080/.../my-contentype/@@add-update-event</a></div>






<div>Traceback (innermost last):</div><div>  Module ZPublisher.Publish, line 126, in publish</div><div>  Module ZPublisher.mapply, line 77, in mapply</div><div>  Module ZPublisher.Publish, line 46, in call_object</div><div>






  Module plone.z3cform.layout, line 70, in __call__</div><div>  Module plone.z3cform.layout, line 54, in update</div><div>  Module tecnoteca.associations.forms.add_update_event, line 36, in update</div><div>  Module z3c.form.form, line 208, in update</div>






<div>  Module plone.z3cform.patch, line 21, in BaseForm_update</div><div>  Module z3c.form.form, line 149, in update</div><div>  Module tecnoteca.associations.forms.add_update_event, line 43, in updateWidgets</div><div>  Module z3c.form.form, line 134, in updateWidgets</div>






<div>  Module z3c.form.field, line 275, in update</div><div>  Module z3c.form.browser.textarea, line 36, in update</div><div>  Module z3c.form.browser.widget, line 70, in update</div><div>  Module z3c.form.widget, line 123, in update</div>






<div>  Module z3c.form.converter, line 43, in toWidgetValue</div><div>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)</div><div><br></div><div><br></div></div>






<div>How can I fix this problem?</div><div><br></div><div>Thanks</div><span><font color="#888888"><span><font color="#888888"><div>Umberto Calligaro</div></font></span>
</font></span><br></div></div>_______________________________________________<br>
Product-Developers mailing list<br>
<a href="mailto:Product-Developers@lists.plone.org" target="_blank">Product-Developers@lists.plone.org</a><br>
<a href="https://lists.plone.org/mailman/listinfo/plone-product-developers" target="_blank">https://lists.plone.org/mailman/listinfo/plone-product-developers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br>