I am unable to save nonprintable characters (e.g. "\x83") to the database using Rails (v2.2).
Simplified example (from the console):
>> f = FileSpace.create( { :name => "/tmp/\x83" } )
=> #<FileSpace id: 7, name: "/tmp/\203">
>> f.name
=> "/tmp/\203"
>> FileSpace.last
=> #<FileSpace id: 7, name: "/tmp/">
So you can see, Rails is silently discarding the "\x83" (or "\203") character from the string.
The "\83" character is not stored in the database:
mysql> SELECT hex(name) FROM file_spaces WHERE id=7;
+------------------------------------+
| hex(name) |
+------------------------------------+
| 2F746D702F |
+------------------------------------+
1 rows in set (0.03 sec)
mysql> select x'2F746D702F';
+---------------+
| x'2F746D702F' |
+---------------+
| /tmp/ |
+---------------+
1 row in set (0.00 sec)
So, how can I get Rails to save the nonprintable character?