Arabic text showing not properly in the file of s3

I have uploaded the csv to s3 with rails, but the issue is, that the file have arabic names, so when i open that csv file directly from s3 console, its showing the arabic names as gibberish, i have attached that image here

also i tried to add that “charset utf”, but its showing as same, is there any workaround for this?

url = object.url_for(:read, {expires: E::EXPIRE,
                 :content_type => "text/csv;charset=utf-8", response_content_disposition: "attachment;filename=#{filename[0]}.csv" }).to_s

You may need to verify the data is not already corrupted in the CSV. The text you’ve pasted looks like the result of double-encoding the names in UTF8. For instance, the first two characters:

ا

are codepoints U+D8 and U+A7. Together, those two bytes (read as UTF8) make up the single character U+0627 (ARABIC LETTER ALEF) which is what I suspect is the intended value.

–Matt Jones

Thanks matt, can you suggest me to do any work around for this, i have been sitting with these issue for some days? the default encoding in my application is config.encoding = “utf-8”

Thanks matt, can you suggest me to do any work around for this, i have been sitting with these issue for some days? the default encoding in my application is config.encoding = “utf-8”

My suggestion would be to go through all the code that’s handling this data and verify that the values are correctly-encoded. For instance:

  • is the data coming into the system from the user correctly encoded?

  • is the database column the data is stored in correctly encoded?

  • is the code that writes the CSV setting the correct encoding?

Corrupted data earlier in the process will generally be passed straight through subsequent steps, so troubleshooting starting from the end (the CSV file on S3) is going to be difficult.

–Matt Jones