td 0.10.53 → 0.10.54

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ == 2012-10-04 version 0.10.54
3
+
4
+ * check invalid byte sequence in UTF-8 string before rendering results on
5
+ console
6
+
7
+
2
8
  == 2012-10-02 version 0.10.53
3
9
 
4
10
  * bulk_import:prepare_parts works with Ruby 1.8
@@ -260,13 +260,17 @@ module Command
260
260
  job.result_each {|row|
261
261
  # TODO limit number of rows to show
262
262
  rows << row.map {|v|
263
- # TODO encoding check
264
263
  if v.is_a?(String)
265
264
  s = v.to_s
266
265
  else
267
266
  s = v.to_json
268
267
  end
269
- s.force_encoding('UTF-8') if s.respond_to?(:force_encoding)
268
+ # Here does UTF-8 -> UTF-16LE -> UTF8 conversion:
269
+ # a) to make sure the string doesn't include invalid byte sequence
270
+ # b) to display multi-byte characters as it is
271
+ # c) encoding from UTF-8 to UTF-8 doesn't check/replace invalid chars
272
+ # d) UTF-16LE was slightly faster than UTF-16BE, UTF-32LE or UTF-32BE
273
+ s = s.encode('UTF-16LE', 'UTF-8', :invalid=>:replace, :undef=>:replace).encode('UTF-8') if s.respond_to?(:encode)
270
274
  s
271
275
  }
272
276
  }
data/lib/td/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.53'
3
+ VERSION = '0.10.54'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.53
4
+ version: 0.10.54
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack