| Paste number 44689: | edsu: marc8 to utf8 sample for pymarc |
| Pasted by: | anarchivist |
| 1 year, 5 months ago | |
| #code4lib | |
| Paste contents: |
| from pymarc import * import sys def marc8_to_utf( marc8string ): converter = MARC8_to_Unicode() converted = converter.translate(marc8string) converted = unicodedata.normalize('NFC', converted) return converted reader = MARCReader(file(sys.argv[1])) titlefile = open(sys.argv[2], 'w') for record in reader: marc8title = record['245'].value() utf8title = marc8_to_utf(marc8title) titlefile.write(utf8title.encode("utf8")) titlefile.write('\n') titlefile.close() |
This paste has no annotations.