Re: encoding for comments

IWS <iws-VG7A+C9aekxy/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Hi,

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?

--
iws-VG7A+C9aekxy/[email protected] 



-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.