Unicode Error

11 messages Options Options
Embed this Post
Permalink
hpinson

Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
We are continually getting this error when we try and translate into
French using the LinguaPlone bundeled with 2.5.2:

UnicodeEncodeError

'ascii' codec can't encode character u'\xe9' in position 11: ordinal
not in range(128)

Does anyone know how to eliminate or work around this error.  


--
Harlow Pinson
Indepth Learning
Email: hpinson@...
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
David Convent-2

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink

On 15 Mar 2007, at 16:34, hpinson@... wrote:

> We are continually getting this error when we try and translate into
> French using the LinguaPlone bundeled with 2.5.2:
>
> UnicodeEncodeError
>
> 'ascii' codec can't encode character u'\xe9' in position 11: ordinal
> not in range(128)
>
> Does anyone know how to eliminate or work around this error.

Could you please send a full traceback and tell us exactly when you  
get this error?
Whithout those info it's quite impossible to just guess what the  
problem is.
--
David


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
hpinson

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by hpinson
Here is the Traceback related to the Unicode Error.

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line
106, in __call__
  Module Products.CMFFormController.ControllerBase, line 232, in
getNext
   - __traceback_info__: ['id = createTranslation', 'status =
success', 'button=None', 'errors={}', 'context=<ATDocument at library-
fr>', "kwargs={'portal_status_message': u'Document a \\xe9t\\xe9
cr\\xe9\\xe9.'}", 'next_action=None', '']
  Module Products.CMFFormController.Actions.RedirectToAction, line
49, in __call__
  Module Products.CMFFormController.Actions.RedirectTo, line 18, in
__call__
  Module Products.CMFFormController.Actions.BaseFormAction, line 130,
in updateQuery
  Module ZTUtils.Zope, line 181, in make_query
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 11: ordinal not in range(128)


--
Harlow Pinson
Indepth Learning
Email: hpinson@...
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Russ Ferriday

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
From this, I think you have ascii as your default encoding.
You probably need utf-8.

My usual solution:

1. create a file called sitecustomize.py containing:

  import sys
  sys.setdefaultencoding("utf-8")

2. put this in <python>/lib/site-packages/

and try again.

(If you are in a windows environment, you may need one of the ISO codepages instead of 'utf-8')

Google " setdefaultencoding sitecustomize " for more on this.

Best,
--r.

On 15 Mar 2007, at 15:51, hpinson@... wrote:

Here is the Traceback related to the Unicode Error. 

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line 
106, in __call__
  Module Products.CMFFormController.ControllerBase, line 232, in 
getNext
   - __traceback_info__: ['id = createTranslation', 'status = 
success', 'button=None', 'errors={}', 'context=<ATDocument at library-
fr>', "kwargs={'portal_status_message': u'Document a \\xe9t\\xe9 
cr\\xe9\\xe9.'}", 'next_action=None', '']
  Module Products.CMFFormController.Actions.RedirectToAction, line 
49, in __call__
  Module Products.CMFFormController.Actions.RedirectTo, line 18, in 
__call__
  Module Products.CMFFormController.Actions.BaseFormAction, line 130, 
in updateQuery
  Module ZTUtils.Zope, line 181, in make_query
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in 
position 11: ordinal not in range(128)


-- 
Harlow Pinson
Indepth Learning
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
_______________________________________________
Plone-i18n mailing list

Russ Ferriday - Topia Systems - Open Source content management with Plone and Zope
russf@... - office: +44 2076 1777588 - mobile: +44 7789 338868 - skype: ferriday
a member of
Zea Partners


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
hpinson

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Thanks Russ. Your solution worked.  :o)

Alex... in interest of making LP better, my question is, why should I
have had to make this mod to my Fedora Core 6 system Python in order
to enable french translation in Plone 2.5.2?  Prior versions have
"just worked" when I translated into French.  I had always assumed
this was just 'handeled' if you set your zope.conf to utf-8 as the
default and did the same in
portal_properties/site_properties/default_charset.

No doubt I will forget about this subtle mod and the problem will
arise again.

Is there any way to handle this automatically upon install or
zope/plone configuration without diving into the system python?


--
Harlow Pinson
Indepth Learning
Email: hpinson@...
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Russ Ferriday

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
You can set the default encoding anywhere reasonable.
Just put those 2 lines in a product __init__.py
But clearly there may be other considerations.
--r

On 15 Mar 2007, at 16:48, hpinson@... wrote:

Is there any way to handle this automatically upon install or 

zope/plone configuration without diving into the system python?


Russ Ferriday - Topia Systems - Open Source content management with Plone and Zope
russf@... - office: +44 2076 1777588 - mobile: +44 7789 338868 - skype: ferriday
a member of
Zea Partners


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
hpinson

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
My guess is that the hosting company did not select UTF-8 as the
default on FC6 system installation.  That probably would have forced
the system python to use it as default.

Thanks again :o)




--
Harlow Pinson
Indepth Learning
Email: hpinson@...
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Russ Ferriday

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Just in general, I'd not be using the system python for zope. - I want more control than that. 
But this is the wrong place to discuss that.
--r
On 15 Mar 2007, at 17:12, hpinson@... wrote:

My guess is that the hosting company did not select UTF-8 as the 
default on FC6 system installation.  That probably would have forced 
the system python to use it as default. 

Thanks again :o)




-- 
Harlow Pinson
Indepth Learning
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
_______________________________________________
Plone-i18n mailing list

Russ Ferriday - Topia Systems - Open Source content management with Plone and Zope
russf@... - office: +44 2076 1777588 - mobile: +44 7789 338868 - skype: ferriday
a member of
Zea Partners


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Dorneles Treméa (PSOL)

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by hpinson
Hey Harlow,

> [...]
>   Module Products.CMFFormController.Actions.BaseFormAction, line 130,
> in updateQuery
>   Module ZTUtils.Zope, line 181, in make_query
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
> position 11: ordinal not in range(128)

this issue was fixed two months ago in CMFFormController:

http://dev.plone.org/collective/changeset/35958

Tip: always try the latest versions when reporting bugs... :-)

--
 ___________________________________________________________________

       Dorneles Treméa · Developer · Plone Solutions · Brazil

   Consulting · Training · Development · http://plonesolutions.com
 ___________________________________________________________________

  Plone Foundation · http://plone.org/foundation · Protecting Plone


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
hpinson

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Hi Dorneles.   Did the fix make it into the 2.5.2 Plone bundle? That
is what we are currently using, installed clean, and is where we
experienced the problem.  We are also using Zope 2.9.6 and its
associated products.

I did resolveit by adding <python>/lib/site-packages

with the lines

  import sys
  sys.setdefaultencoding("utf-8")

As suggested by Russ.


--
Harlow Pinson
Indepth Learning
Email: hpinson@...
Phone: 505 994-2135
Fax: 505 994-3603


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Dorneles Treméa (PSOL)

Re: Unicode Error

Reply Threaded MoreMore options
Print post
Permalink
Hello Harlow,

> Did the fix make it into the 2.5.2 Plone bundle?

there's no bundles for minor versions. There's only a 2.5 bundle[1]
and it uses the CMFFormController 2.0 branch, which contains the
mentioned fix.

Of course, it'll be included into the yet-to-be-released 2.5.3
Plone version, but not in the already released 2.5.2.

> That is what we are currently using, installed clean, and is
> where we experienced the problem. We are also using Zope 2.9.6
> and its associated products.

Sure, no problems in using released software. But keep in mind
that before reporting a new bug, it's recommended that you first
check if it wasn't already fixed in the latest (not yet released)
versions.

Just to make my point, this particular issue was already reported
before, a quick search point us to:

http://dev.plone.org/plone/ticket/6065

BTW, Zope 2.9.6 also has some nasty bugs... :-)

> I did resolveit by adding <python>/lib/site-packages
>
> with the lines
>
>   import sys
>   sys.setdefaultencoding("utf-8")
>
> As suggested by Russ.

It's a possible solution, but only use it if you know the
implications. Google for 'setdefaultencoding is evil' to have
an idea... :-)

[1]http://svn.plone.org/svn/plone/bundles/2.5
[2]http://svn.plone.org/svn/collective/CMFFormController/branches/2.0

Kindly regards,

--
 ___________________________________________________________________

       Dorneles Treméa · Developer · Plone Solutions · Brazil

   Consulting · Training · Development · http://plonesolutions.com
 ___________________________________________________________________

  Plone Foundation · http://plone.org/foundation · Protecting Plone


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n