Arabic text showing not properly in the file of s3

39 views
Skip to first unread message

amtest

unread,
Aug 20, 2015, 7:03:13 AM8/20/15
to Ruby on Rails: Talk

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

Matt Jones

unread,
Aug 21, 2015, 7:55:00 AM8/21/15
to Ruby on Rails: Talk
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

amtest

unread,
Aug 21, 2015, 8:24:46 AM8/21/15
to Ruby on Rails: Talk
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"

Matt Jones

unread,
Aug 24, 2015, 2:09:35 PM8/24/15
to Ruby on Rails: Talk


On Friday, 21 August 2015 08:24:46 UTC-4, amtest wrote:
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
Reply all
Reply to author
Forward
0 new messages