diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/normalize_string.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/normalize_string.rb b/lib/normalize_string.rb index e708a8d96..f02b18ee0 100644 --- a/lib/normalize_string.rb +++ b/lib/normalize_string.rb @@ -73,3 +73,14 @@ def convert_string_to_utf8_or_binary(s, suggested_character_encoding=nil) end result end + +def log_text_details(message, text) + if RUBY_VERSION.to_f >= 1.9 + STDERR.puts "#{message}, we have text: #{text}, of class #{text.class} and encoding #{text.encoding}" + else + STDERR.puts "#{message}, we have text: #{text}, of class #{text.class}" + end + filename = "/var/tmp/#{Digest::MD5.hexdigest(text)}.txt" + File.open(filename, "wb") { |f| f.write text } + STDERR.puts "#{message}, the filename is: #{filename}" +end |