Issue 1240848
Created on 2005-07-19 13:47 by anonymous, last changed 2006-01-25 03:14 by richard.
File name |
Uploaded |
Description |
Edit |
Remove |
actions.py.diff
|
a1s,
2005-07-20 04:53
|
|
|
|
msg1997 |
Author: [hidden] (anonymous) |
Date: 2005-07-19 13:47 |
|
Hello,
Thanks for very useful tool!
I've found my Microsoft Excel file doesn't understand a
CSV file generated by Roundup. It's because I've
configured Roundup to use utf-8 and the Excel doesn't
understand the utf-8.
I've patched up small amount of code as follows.
cgi/actions.py
import codecs
<snip>
class ExportCSVAction(Action):
<snip>
def handle(self):
<snip>
encoding = request.form.getvalue('encoding')
<snip>
# writer = csv.writer(self.client.request.wfile)
wf = self.client.request.wfile
if encoding:
try:
wf =
codecs.EncodedFile(self.client.request.wfile, 'utf-8',
encoding, 'replace')
except:
pass
writer = csv.writer(wf)
<snip>
So, &encoding=mbcs will work for my environment (or
ms932 in JapaneseCodecs installed). For example,
html/issue.index.html
<a tal:attributes="href
python:request.indexargs_url('issue',
{'@action':'export_csv','encoding':
'ms932'})" i18n:translate="">Download as CSV</a>
I hope it's useful for you all.
|
msg1998 |
Author: [hidden] (a1s) |
Date: 2005-07-20 04:53 |
|
Logged In: YES
user_id=8719
nice idea.
the attached patch does the same using standard roundup
charset preference.
|
msg1999 |
Author: [hidden] (richard) |
Date: 2006-01-25 03:14 |
|
Logged In: YES
user_id=6405
We like patches :)
|
|
Date |
User |
Action |
Args |
2005-07-19 13:47:04 | anonymous | create | |
|