Re: Problem with Danish characters?
Mark Sapiro <mark <at> msapiro.net>
2009-04-23 15:08:30 GMT
Kaja P. Christiansen wrote:
>
>I have (so far) been unable to show correctly Danish characters
>in the names of the list members. Let me give 2 examples.
>
>1.
>Say I create a list 'test' and subscribe a member like here:
> newlist -l da test kaja <at> cs.au.dk kaja
> echo "Kaja Jørgensen <kaja <at> cs.au.dk>" | add_members -r - -a n -w n test
>to which Mailman responds with:
> Tilmeldt: Kaja Jørgensen <kaja <at> cs.au.dk>
>
>So far so good. Now I ask for the membership list with
> list_members -f test
>and receive back:
> Kaja J?rgensen <kaja <at> cs.au.dk>
The name 'Kaja Jørgensen' is stored internally as a python unicode
object. list_members encodes this for display using the encoding given
by Python's sys.getdefaultencoding(). This in turn defaults to
"ascii". If you want list_members to show non-ascii characters as
other than '?', you have two choices.
You can edit the definition of setencoding() in
/usr/lib/pythonV.V/site.py to replace "ascii" with "iso-8859-1", or
you can edit Mailman's bin/list_members and replace the line
ENC = sys.getdefaultencoding()
with
ENC = "iso-8859-1"
>2.
>I edit the membership list from the web page:
>- go to Membership List
>- replace member name Kai Nielsen with Kai Jørgensen Nielsen (looks good)
>- submit changes
>- go to another web membership page, then back to one with 'Kai...'
> and see: Kai Jørgensen Birger Nielsen
Again, the name is properly stored internally. This display is due to
over-protection of the web interface from cross-site-scripting
attacks. The attached file escape_html.patch.txt contains a patch that
will allow these names to display properly in the admin Membership
List.
--
Mark Sapiro <mark <at> msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
--- f:/test-mailman-2.2/Mailman/Utils.py 2009-03-12 15:28:34.000000000 -0700
+++ f:/test-mailman/Mailman/Utils.py 2009-03-21 20:10:12.593750000 -0700
<at> <at> -425,8 +425,10 <at> <at>
+_ampre = re.compile('&((?:#[0-9]+|[a-z]+);)', re.IGNORECASE)
def websafe(s):
- return cgi.escape(s, quote=True)
+ # Don't double escape html entities
+ return _ampre.sub(r'&\1', cgi.escape(s, quote=True))
def nntpsplit(s):