Re: encoding for comments
gabor <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <1084949298.13436.7.camel@dubb> |
On Wed, 2004-05-19 at 12:57 +0900, IWS wrote: > Michael Davidson <[email protected]> writes: > > On Tue, 18 May 2004, gabor ([email protected]) wrote: > >> if config.has_key('blog_encoding'): > >> encoding = config['blog_encoding'] > >> else: > >> encoding = 'iso-8859-1' > >> cfile.write('<?xml version="1.0" encoding="'+encoding+'"?>\n') > > > > This won't work as written. You can't just put the encoding in the xml > > file; you have to write to the file using the given encoding. You should > > try using the string.encode method to do this. > > Since 0.8, I have modified comments.py like this: > > | cfile.write('<?xml version="1.0" encoding="%s"?>\n' % config.get('blog_encoding', 'utf-8')) > > and put the following line in my config.py: > > | py['blog_encoding'] = "utf-8" > > These are enough to handle utf-8 coded (Japanese) comment. > No more change required, and the original comments.py didn't work well in my > case. Is iso-8859-1 better default value than utf-8? depends on how you define 'better' :)) imho: 1. utf-8 is always better than iso-8859-1, because you can encode any unicode data into utf-8, but not into iso-8859-1 2. the default encoding for http based stuff seems to be iso-8859-1 (means, that if it is not specified, it is latin1) so i'd say utf-8 is better, but iso-8859-1 is more safe... 3. consistency...to what does pyblosxom default if there's noe blog_encoding specified? imho comments.py should default to the same... from a "grep blog_encoding Pyblosxom -R" it seems that renderers/blosxom.py defaults to latin1 (config.get('blog_encoding', 'iso-8859-1')))...but perharps this could be changed ? generally i am for utf-8 and consistency :>> gabor ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click