json dump file should be opened in binary mode to support ruby 1.9?

89 views
Skip to first unread message

Gokul Janga

unread,
May 23, 2012, 1:46:46 AM5/23/12
to picky...@googlegroups.com
I was trying to index a table from a db that encoding set to 'unicode' and ended up with the following error.

Picky is indexing using a single process: Trake aborted!
"\xCC" from ASCII-8BIT to UTF-8

This might be the result of a problem explained here -
From the answer to that question, it looks ike the json_dump method (see below) in Picky's code 
should open the file in binary mode to resolve this? 

picky/backends/memory/json.rb:
   18          #
   19          def load
   20:           Yajl::Parser.parse ::File.open(cache_path, 'r') # , symbolize_keys: true # TODO Symbols.
   21          end
   22  
   ..
   31          #
   32          def dump_json internal
   33:           ::File.open(cache_path, 'w') do |out_file|
   34              Yajl::Encoder.encode internal, out_file
   35            end

Picky / Florian Hanke

unread,
Jun 18, 2012, 9:17:41 PM6/18/12
to picky...@googlegroups.com
Hi Gokul,

Sorry for the late response. I think I got confused since there is also an issue on Github on this.

This might be a good solution to the problem! I'll look into it.

Cheers and thanks,
   Florian
Reply all
Reply to author
Forward
0 new messages