RE: [Zope-CMF] Re: .metadata files, latin-1 vs. unicode, and encoding errors

2006-09-06 Thread Doyon, Jean-Francois
+1

Especially since the FSMetadata class isn't a mix-in so it turns out
getting to the site instance's encoding isn't easy.

Want me to file a bug?

J.F. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dieter Maurer
Sent: September 5, 2006 3:00 PM
To: Florent Guillaume
Cc: Doyon, Jean-Francois; Zope CMF
Subject: Re: [Zope-CMF] Re: .metadata files, latin-1 vs. unicode,and
encoding errors

Florent Guillaume wrote at 2006-9-4 20:38 +0200:
>I'd say it would be cleaner to let the .metadata specify its own 
>encoding, for instance with a # coding: utf-8 at the top, and pasrse 
>that in FSMetadata.

I find this a good suggestions -- but would use the declaration syntax
used also in (e.g.) Python.



--
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Re: .metadata files, latin-1 vs. unicode, and encoding errors

2006-09-05 Thread Dieter Maurer
Florent Guillaume wrote at 2006-9-4 20:38 +0200:
>I'd say it would be cleaner to let the .metadata specify its own encoding, 
>for instance with a
># coding: utf-8
>at the top, and pasrse that in FSMetadata.

I find this a good suggestions -- but would use the declaration syntax
used also in (e.g.) Python.



-- 
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


RE: [Zope-CMF] Re: .metadata files, latin-1 vs. unicode, and encoding errors

2006-08-28 Thread Doyon, Jean-Francois
Yup, thanks, just figured out the problem, I was decoding improperly.

I've patched FSMetadata._nullParser to decode for me.  I hardcoded 
latin_1_decode, but I guess your suggestion is cleaner!

Thanks,
J.F.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yuppie
Sent: August 28, 2006 2:25 PM
To: Doyon, Jean-Francois; Zope-CMF List
Subject: [Zope-CMF] Re: .metadata files, latin-1 vs. unicode,and encoding errors

Hi Jean-François!


Doyon, Jean-Francois wrote:
> My app started throwing unicode errors, and I've tracked it down to the fact 
> I have accents in .metadata files.
> 
> This becomes a problem when a unicode string sneaks into the page to be 
> rendered, at which time StringIO.getvalue() bombs.
> 
> Normally I'd try to get rid of the unicode string, but in this case it seems 
> like it's coming from the i18n machinery (The result of a translation), and 
> as such, might not be very desirable for me to mess with it.
> 
> For example I have an FSImage with a title that in french contains an 
> accented character.
> 
> When calling the tag() method on the image, I end up with a  with 
> high bit characters.
> 
> The same page will contain i18n:translate results, which are unicode.
> 
> And voila.
> 
> I tried making the FSMetadata logic return a unicode string instead of a 
> regular string, but that didn't work (not too clear on why, the logging 
> module started throwing errors?).
> 
> I also tried using HTML entities such as é in there, but looks like 
> HTML title= or alt= doesn't render them?
> 
> Anyone have any ideas how I might get around this?  I'm out of ideas 
> :(

I guess you are using CMF 2.0. In CMF 2.0 all data used in PageTemplates has to 
be unicode (or ASCII). AFAICS you have to convert the value returned by tag(). 
CMFDefault utils has a 'decode' function that uses the default_charset of the 
site to decode the string.


HTH,

Yuppie

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org 
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests