Improve and document fix_string()

Use doctest to test the fix_string() documentation.