You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2012/11/28 23:33:59 UTC
svn commit: r1414972 - in /avro/trunk: CHANGES.txt lang/ruby/Rakefile
lang/ruby/lib/avro/io.rb lang/ruby/test/test_datafile.rb
Author: cutting
Date: Wed Nov 28 22:33:57 2012
New Revision: 1414972
URL: http://svn.apache.org/viewvc?rev=1414972&view=rev
Log:
AVRO-1206. Ruby: Fix UTF-8 handling in Ruby 1.9. Contributed by Nicolas Fouché.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/ruby/Rakefile
avro/trunk/lang/ruby/lib/avro/io.rb
avro/trunk/lang/ruby/test/test_datafile.rb
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1414972&r1=1414971&r2=1414972&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Nov 28 22:33:57 2012
@@ -57,6 +57,9 @@ Trunk (not yet released)
AVRO-1201. Java: Fix GenericData#toString() to generate valid JSON for
enum values. (Sharmarke Aden via cutting)
+ AVRO-1206. Ruby: Fix UTF-8 handling in Ruby 1.9.
+ (Nicolas Fouché via cutting)
+
Avro 1.7.2 (20 October 2012)
NEW FEATURES
Modified: avro/trunk/lang/ruby/Rakefile
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/Rakefile?rev=1414972&r1=1414971&r2=1414972&view=diff
==============================================================================
--- avro/trunk/lang/ruby/Rakefile (original)
+++ avro/trunk/lang/ruby/Rakefile Wed Nov 28 22:33:57 2012
@@ -21,7 +21,7 @@ Echoe.new('avro', VERSION) do |p|
p.author = "Apache Software Foundation"
p.email = "avro-dev@hadoop.apache.org"
p.summary = "Apache Avro for Ruby"
- p.description = "Apache is a data serialization and RPC format"
+ p.description = "Avro is a data serialization and RPC format"
p.url = "http://hadoop.apache.org/avro/"
p.runtime_dependencies = %w[yajl-ruby]
end
Modified: avro/trunk/lang/ruby/lib/avro/io.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/io.rb?rev=1414972&r1=1414971&r2=1414972&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/io.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/io.rb Wed Nov 28 22:33:57 2012
@@ -201,7 +201,7 @@ module Avro
# Bytes are encoded as a long followed by that many bytes of data.
def write_bytes(datum)
- write_long(datum.size)
+ write_long(datum.bytesize)
@writer.write(datum)
end
Modified: avro/trunk/lang/ruby/test/test_datafile.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/test/test_datafile.rb?rev=1414972&r1=1414971&r2=1414972&view=diff
==============================================================================
--- avro/trunk/lang/ruby/test/test_datafile.rb (original)
+++ avro/trunk/lang/ruby/test/test_datafile.rb Wed Nov 28 22:33:57 2012
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -140,4 +141,17 @@ JSON
assert_equal(block_count+1, dw.block_count)
end
end
+
+ def test_utf8
+ datafile = Avro::DataFile::open('data.avr', 'w', '"string"')
+ datafile << "家"
+ datafile.close
+
+ datafile = Avro::DataFile.open('data.avr')
+ datafile.each do |s|
+ assert_equal "家", s
+ end
+ datafile.close
+ end
+
end