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

1

10

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.

Tumefacient answered 7/7, 2016 at 9:27 Comment(2)
Do you use amazon s3 for you're storage?Tumefacient
Do you have a backtrace?Everyman
E
4

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.

Everyman answered 13/9, 2016 at 19:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.