In Python you can use the array module to quickly convert ASCII values to a string and back again.
>>> import array
>>> array.array('B', [97, 98, 99]).tostring()
'abc'
>>> array.array('B', 'abc').tolist()
[97, 98, 99]
For more information, read Python Patterns - An Optimization Anecdote.
arraysasciiconversionmodulesoptimizationpython
If you need to convert a TEXT column to a BYTEA column, you can use a cast expression to do the work:
ALTER TABLE mytable ALTER COLUMN col TYPE bytea USING decode(replace(col, '\\', '\\\\'), 'escape');
Note that altering the column type of a column is only supported beginning with PostgreSQL version 8.0. For more information, see the manual.
byteacastconversiondatabasemodificationpostgresqlschemasqltext
If you find yourself needing to drop the case on the entire contents of a file, you can try this:
$ dd if=original of=filtered conv=lcase -or- $ tr '[A-Z]' '[a-z]' < original > filtered
charactersconversionddfilterlowercaseshelltr