Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"\xFF" from ASCII-8BIT to UTF-8 using paperclip

I got a problem using paperclip gem in rails. I was following this tutorial https://devcenter.heroku.com/articles/paperclip-s3

I got this param in my avatar ActionDispatch::Http::UploadedFile:0x007f5f2bdafde0 that give me this error when i'm using json:

"\xFF" from ASCII-8BIT to UTF-8

So anyone know what i have to do with this param ? I tried to force encode it but it's not working any ideas?

I am using s3 amazon service for upload my avatar.

like image 988
maluss Avatar asked Jul 07 '16 09:07

maluss


1 Answers

Don't know if this is helpful or a answer but the best guess that I can give is that the string is a from UploadedFile class is returning a 'ASCII-8BIT'. Best solution for this problem normal is to do something like this on IO.

file.read.force_encoding(Encoding::UTF_8)

This can work for what you are doing however if you don't have access to the line of code your trying to fix it can be difficult.

like image 106
newdark-it Avatar answered Nov 05 '22 10:11

newdark-it