requrie 'yaml'
hash = {:title=>'abc'}
hash.to_yaml
will output:
---
title: abc
Is there any method to force the title to be a binary, like:
---
title: !binary|
5Lit5pa
UPDATE
I'm asking this because I want to dump the data from database to yml files. But the text in the database, contains English and non-English text, and both may have such code:
<% xxx %>
When I use rake db:fixtures:load
, there will be an error like method xxx not found
.
I can replace '<%' with '<%%' before writing to file, but it's only works for the English text -- If there is any non-English charactors, the content will be binary. When loading back, '<%%' is still '<%%'. I don't find a good solution unless I can force 'to_yaml' always using 'binary' for text.