Permalink
Browse files

Added another test and comparison of chars for 1.9

  • Loading branch information...
1 parent 55946e3 commit b3eb99e6c8706fb3b72ed44bdf47ab6a9ba0824b @luislavena committed Nov 14, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 encoding-output.rb
View
@@ -6,13 +6,16 @@
line = "Ésta es una línea"
encoded = line.encode(Encoding.default_external)
-puts "length: #{line.length}"
-puts "encoded length: #{encoded.length}"
-puts "bytes: #{line.bytes.to_a.length}"
-puts "encoded bytes: #{encoded.bytes.to_a.length}"
+puts "line.size: #{line.size}"
+puts "encoded.size: #{encoded.size}"
+puts "line.bytesize: #{line.bytesize}"
+puts "encoded.bytesize: #{encoded.bytesize}"
puts line
puts encoded
print line, "\n"
print encoded, "\n"
+
+line.chars.each { |c| print c }; print "\n"
+encoded.chars.each { |c| print c }; print "\n"

0 comments on commit b3eb99e

Please sign in to comment.