Ok, Lars,

the attached file, generate_contributions.py, is a python script that both
stores and manipulates the raw data needed to create CREDITS, credits.php
and blanket-permission.php

Usage:
$ python generate_contributions.py \
  CREDITS2 \
  credits2.php \
  blanket-permission2.php

where the arguments are the names of the generated files.

The only problem I have is that I can't output CREDITS as latin1
because some of the entries won't convert. Changing this line:

  txt_credits_data = unicode(as_txt_credits(contributers)).encode("utf-8")

to 'encode("latin1")' results in this exception:

Traceback (most recent call last):
  File "generate_contributions.py", line 1110, in ?
    main(sys.argv)
  File "generate_contributions.py", line 1097, in main
    txt_credits_data =
unicode(as_txt_credits(contributers)).encode("latin1")
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u011b' in
position 1729: ordinal not in range(256)

We're not ready to use CREDITS encoded in UTF-8 yet.

Any gurus got a python solution?

I know that I could pass the generated CREDITS file through recode but a
one-stop solution would be nice.

$ recode 'UTF-8..ISO-8859-1' < CREDITS2 > CREDITS3
$ diff -u CREDITS CREDITS3 | recode 'ISO-8859-1..UTF-8' | less

-- 
Angus

Attachment: generate_contributions.py.bz2
Description: BZip2 compressed data

Reply via email to