The Python version below.
OpenLDAP 2.4: Read stored UTF-8 data http://yasu-2.blogspot.jp/2009/10/openldap-24-utf-8.html
Since it was an environment where ruby could not be installed, I made something that works with Python, which is often included by default. I wrote it while remembering Python in about 30 minutes, so I'm guessing the result. It takes longer to remember than to write ...
lsuf.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, re
for line in sys.stdin:
if re.match(r'^\w+::\s', line):
label, b64item = line.split()
print label, b64item.decode('base64')
else:
sys.stdout.write(line)
(@Shiracamus made it simple, so I reflected it. Thank you!)
Recommended Posts