#!/usr/bin/env python
"""
A small Python script that strips non-ascii characters from PEM files,
replacing them with escaped backslashes.
"""
import sys

for line in sys.stdin.buffer:
    line = line.decode('utf-8')
    line = line.encode('ascii', errors='backslashreplace')
    sys.stdout.buffer.write(line)
