fix encoding for safe text