Created
February 25, 2011 17:16
-
-
Save sunkencity/844114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Short words in Rails locale files with åäö become binary! | |
# But the _why oneliner seems to work. The problem is probably elsewhere. Logging this for reference. | |
# | |
# http://stdlib.rubyonrails.org/libdoc/yaml/rdoc/classes/String.html | |
# File yaml/rubytypes.rb, line 145 | |
# def is_binary_data? | |
# ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) unless empty? | |
# end | |
str = "Fråga" | |
puts str.count( "^ -~", "^\r\n" ) / str.size > 0.3 | |
puts str.count( "\x00" ) > 0 | |
puts "RnLDpWdh".unpack("m") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment