avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1447957 - in /avro/trunk: CHANGES.txt lang/ruby/lib/avro/io.rb
Date Tue, 19 Feb 2013 23:11:12 GMT
Author: cutting
Date: Tue Feb 19 23:11:12 2013
New Revision: 1447957

URL: http://svn.apache.org/r1447957
Log:
AVRO-1257. Ruby: Fix UTF-8 encoding in Ruby 1.9.  Contributed by Martin Kleppmann.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/ruby/lib/avro/io.rb

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1447957&r1=1447956&r2=1447957&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Feb 19 23:11:12 2013
@@ -88,6 +88,9 @@ Trunk (not yet released)
     AVRO-1215. Java: Fix AvroMultipleOutputs when specifying baseOutputPath.
     (Ashish Nagavaram via cutting)
 
+    AVRO-1257. Ruby: Fix UTF-8 encoding in Ruby 1.9.
+    (Martin Kleppmann via cutting)
+
 Avro 1.7.3 (6 December 2012)
 
   NEW FEATURES

Modified: avro/trunk/lang/ruby/lib/avro/io.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/io.rb?rev=1447957&r1=1447956&r2=1447957&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/io.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/io.rb Tue Feb 19 23:11:12 2013
@@ -96,8 +96,9 @@ module Avro
       def read_string
         # A string is encoded as a long followed by that many bytes of
         # UTF-8 encoded character data.
-        # FIXME utf-8 encode this in 1.9
-        read_bytes
+        read_bytes.tap do |string|
+          string.force_encoding("UTF-8") if string.respond_to? :force_encoding
+        end
       end
 
       def read(len)



Mime
View raw message