Open alexchee opened 10 years ago
I'm having an issue after upgrading to Ruby 2.1.0, with creating notes with binary data. I get a conversion error: Encoding::UndefinedConversionError: "\xC7" from ASCII-8BIT to UTF-8
Here's what I do to replicate with any pdf file:
client = EvernoteOAuth::Client.new(config) pdf = File.open('test.pdf', 'rb') { |io| io.read } file_name='test.pdf' hexdigest = Digest::MD5.new.hexdigest(pdf) data = Evernote::EDAM::Type::Data.new(:size=> pdf.size, :bodyHash=> hexdigest, :body=>pdf) resource_attributes = Evernote::EDAM::Type::ResourceAttributes.new(:fileName => file_name) resource = Evernote::EDAM::Type::Resource.new(:mime=>'application/pdf', :data=>data, :attributes=>resource_attributes) content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'+ %Q{ <en-note><en-media type='#{resource.mime}' hash='#{hexdigest}'/></en-note>} note = Evernote::EDAM::Type::Note.new(:title=> title, :content=> content, :resources=>[resource], :notebookGuid=>'notebook_guid']) client.note_store.createNote(note)
Here's the backtrace:
thrift-0.9.1/lib/thrift/bytes.rb:81:in `encode' thrift-0.9.1/lib/thrift/bytes.rb:81:in `convert_to_utf8_byte_buffer' thrift-0.9.1/lib/thrift/protocol/binary_protocol.rb:110:in `write_string' thrift-0.9.1/lib/thrift/client.rb:35:in `write' thrift-0.9.1/lib/thrift/client.rb:35:in `send_message' evernote-thrift-1.25.1/lib/Evernote/EDAM/note_store.rb:678:in `send_createNote' evernote-thrift-1.25.1/lib/Evernote/EDAM/note_store.rb:673:in `createNote' evernote_oauth-0.2.2/lib/evernote_oauth/thrift_client_delegation.rb:11:in `method_missing'
This might be an evernote-thrift issue.
Were you able to resolve this issue?
No, I'm still waiting for an answer.
I'm having an issue after upgrading to Ruby 2.1.0, with creating notes with binary data. I get a conversion error: Encoding::UndefinedConversionError: "\xC7" from ASCII-8BIT to UTF-8
Here's what I do to replicate with any pdf file:
Here's the backtrace:
This might be an evernote-thrift issue.