[Zope3-dev] Re: Existential question about BytesWidget v.s. ASCIIWidget

Stéphane Brunet stbru at teksavvy.com
Mon Jun 13 15:25:17 EDT 2005


Jim Fulton wrote:

>
> Oh, that. Waaaaa.  Christian Theune almost had this fixed last year
> at EuroPython.
>
> This is also related to a File object refactoring that someone *almost*
> finished recently.

What kind of refactoring ? Is it already in the trunk ?

>
> I don't know what your solution looks like at this point. But I'll note:
>
> - File objects store Bytes data.  Not unicode.
>
I did not changed anything to the IFile interface. Text or not, the 
content is always stored on the Bytes field.

> - For text content, File object's want to keep track of an
>   encoding.
>
This is not what I understood of the description of issue 302 on 
Collector (see 
http://mail.zope.org/pipermail/zope3-dev/2004-October/012371.html ).

My solution just convert the text input to UTF-8 before for storage in 
the Bytes field. A UTF-8 specific widget (very similar to the future 
ASCIIAreaWidget) is used in the edit form. When the text file is 
displayed, the content is converted to unicode and afterwards to the 
preferred encoding of the user's browser. This works quite well on my 
computer...

> I expect that, in the long term (3.2?), we'll need to totally redo
> Files to make then sane and to take advantage of ZODB Blobs.
>
Resolving issue 302 is on the todo list for 3.1. However, one could take 
advantage of this future refactoring in order to merge I18NFile and File 
into a single package. After all, a non-i18n file is just a i18n file 
with a default language...

BTW, I18NFile is also broken because of encoding problems. I was not 
able to enter non-ASCII characters in the text area... That's pretty 
problematic for a I18N-aware product :-D

Stéphane



More information about the Zope3-dev mailing list