Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion usr/share/zookeeper-util/bin/zk_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
zk.create_path(a[0].chomp)
elsif(a.size == 2)
puts "# Writing data '#{a[1]}' to Path #{a[0]}" if options[:verbose]
zk.set_data(a[0].chomp, a[1].chomp)
zk.set_data(a[0].chomp, JSON.load(a[1]).encode('ISO-8859-1'))
else
puts "#{line} is broken"
end
Expand Down
3 changes: 2 additions & 1 deletion usr/share/zookeeper-util/bin/zookeeper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'java'
require 'json'

share_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
Dir.glob(File.join(share_dir, "java/zookeeper-util/*jar")).each {|p| $CLASSPATH << p}
Expand Down Expand Up @@ -88,7 +89,7 @@ def dump(path, separator=DEFAULT_SEPARATOR)
stat = Stat.new
new_path = File.join(path, node)
d = @zk.get_data(new_path, false, stat) || ''.to_java_bytes
node_data = "#{String.from_java_bytes(d)}"
node_data = "#{String.from_java_bytes(d)}".force_encoding("ISO-8859-1").encode("UTF-8").to_json
puts node_data.to_s.empty? ? "#{new_path}" : "#{new_path}#{separator}#{node_data}"

dump(new_path, separator) unless (stat.getNumChildren == 0)
Expand Down