I'm build API server with grape and android client.
When I make post API for upload content and image, confront to encoding issue.
I sent message and image to server using 'utf-8' encoding, but server recognized message using 'ascii-8bit' encoding.
I tested string information using behind code.
puts "DEBUG ---- content : #{params[:content].unpack("H*")}"
puts "DEBUG ---- content : #{params[:content].encoding}"
puts "DEBUG ---- content2 : #{"테스트테스트".unpack("H*")}"
puts "DEBUG ---- content2 : #{"테스트테스트".encoding}"
The result is
DEBUG ---- content : ["ed858cec8aa4ed8ab8ed858cec8aa4ed8ab8"]
DEBUG ---- content : ASCII-8BIT
DEBUG ---- content2 : ["ed858cec8aa4ed8ab8ed858cec8aa4ed8ab8"]
DEBUG ---- content2 : UTF-8
so this two strings are having same data, but miss understand on server.
Thank you for your advice.
Tae-ho.