Closed huacnlee closed 12 years ago
I also have this issue, It seems that paperclip pass a string in ASCII-8BIT when calling attribute setter, which cause the adapter reject the string.
+1 My rails version is 3.0.7 and paperclip version is 2.3.11 I alose got this ussue.when uploaded file with a chinese name(eg:'后来.mp3'), it will cause an enception below: Encoding::CompatibilityError in VoicesController#create incompatible character encodings: UTF-8 and ASCII-8BIT
But it goes well with english file name.
That's actually the problem with Ruby 1.9.2. I think you have to solve your problem by putting a magic comment in your header file:
# encoding: utf-8
No, no no, I was added that in my source file header, but it not effect, uploading Chinese name "后来.mp3" still raise: Encoding::CompatibilityError in VoicesController#create incompatible character encodings: UTF-8 and ASCII-8BIT
+1 for @huacnlee
+1 for @huacnlee I need to force_encoding('UTF-8') to solve this issue, so I suspect it's cause by where the string is created.
I'll try to reproduce this error again then.
I have this issue also. I had added # encoding: utf-8 on the upoload views and add below content on environment.rb :
if defined? Encoding Encoding.default_internal = 'UTF-8' Encoding.default_external = Encoding::UTF_8 end
Hope can solved it in the near future
here is the example log for sikachu to reproduce it :
Started POST "/restaurants/1363" for 219.136.205.238 at 2011-07-07 10:30:08 +0800
Processing by RestaurantsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"rUCrdp8yyN8oIHLCFMzvYz8kvX8L4WAaKalMI2ScQq8=", "restaurant"=>{"name"=>"宝盛大酒店", "address"=>"山东省肥城市龙山路20号 ", "uptime"=>"AM09:00-PM22:00", "province_id"=>"9", "city"=>"67", "dist"=>"881", "tel"=>"0538—3237888 ", "fax"=>"0538—3232788 ", "contact_name"=>"", "contact_tel"=>"", "email"=>"", "is_teled"=>"1", "is_visited"=>"0", "is_signed"=>"0", "is_hoted"=>"0", "signed_name"=>"", "visited_date(1i)"=>"2011", "visited_date(2i)"=>"7", "visited_date(3i)"=>"7", "signed_date(1i)"=>"2011", "signed_date(2i)"=>"7", "signed_date(3i)"=>"7", "remark"=>"普通包房最低消费
600/包,12位最低800/包,16位最低1500/包,没有服务费,不可以自带酒水,", "map_url"=>"MAPBZNYASPXOFBTEZMHAX", "style"=>"17", "Traffic"=>"", "mood"=>"清汤辽参 鲍汁扣辽参 鱼头浓汤 过桥仔排 小鲍鱼捞饭", "avatar"=>#<ActionDispatch::Http::UploadedFile:0xb10560c @original_filename="\xE5\xAE\x9D\xE7\x9B\x9B\xE5\xA4\xA7\xE9\x85\x92\xE5\xBA\x97.jpg", @content_type="image/pjpeg", @headers="Content-Disposition: form-data; name=\"restaurant[avatar]\"; filename=\"E:\\\xE9\xA4\x90\xE5\x8E\x85\xE5\x9B\xBE\xE7\x89\x87\\\xE5\xB1\xB1\xE4\xB8\x9C\xE7\x9C\x81\\\xE6\xB3\xB0\xE5\xAE\x89\xE5\xB8\x82\\\xE8\x82\xA5\xE5\x9F\x8E\xE5\xB8\x82\\\xE5\xAE\x9D\xE7\x9B\x9B\xE5\xA4\xA7\xE9\x85\x92\xE5\xBA\x97.jpg\"\r\nContent-Type: image/pjpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20110707-1129-84mtb9>>, "shor_desc"=>"宝盛大酒店座落于泰山西麓——肥城,
东依东岳泰山26公里,南临圣城曲阜70公里,西望水泊梁山86公里,北靠泉城济南68公里。位于山东“一山一水一圣人”旅游线路的中心。周边与京沪、京福高速公路及104国道相连,交通十分方便。\r\n 宝盛大酒店主楼高20层,建筑
面积29000平方米,酒店拥有各种类型客房,大中小会议室8个及大型功能厅1个,大型中餐厅2个,风格各异的餐饮包厢35个。", "desc"=>""}, "commit"=>"提 交", "id"=>"1363"}
^[[1m^[[36mUser Load (0.1ms)^[[0m ^[[1mSELECT `users`.* FROM `users` WHERE `users`.`id` = 54 LIMIT 1^[[0m
^[[1m^[[35mCACHE (0.0ms)^[[0m SELECT `users`.* FROM `users` WHERE `users`.`id` = 54 LIMIT 1
^[[1m^[[36mRestaurant Load (0.1ms)^[[0m ^[[1mSELECT `restaurants`.* FROM `restaurants` WHERE `restaurants`.`id` = 1363 LIMIT 1^[[0m
^[[1m^[[35mSQL (0.1ms)^[[0m BEGIN
^[[1m^[[36mAREL (0.4ms)^[[0m ^[[1mUPDATE `restaurants` SET `input_time` = '2011-07-07 10:30:08', `updated_at` = '2011-07-07 10:30:08' WHERE `restaurants`.`id` = 1363^[[0m
^[[1m^[[35mActsAsTaggableOn::Tag Load (0.8ms)^[[0m SELECT `tags`.* FROM `tags` WHERE (name LIKE '清汤辽参 鲍汁扣辽参 鱼头浓汤 过桥仔排')
^[[1m^[[36mActsAsTaggableOn::Tag Load (0.1ms)^[[0m ^[[1mSELECT `tags`.* FROM `tags` INNER JOIN `taggings` ON `tags`.id = `taggings`.tag_id WHERE ((`taggings`.taggable_id = 1363) AND (`taggings`.taggable_type = 'Restaurant')) AND (taggings.context = 'famous' AND taggings.tagger_id IS NULL)^[[0m
^[[1m^[[35mActsAsTaggableOn::Tagging Load (0.2ms)^[[0m SELECT `taggings`.* FROM `taggings` WHERE `taggings`.`tagger_type` IS NULL AND `taggings`.`tagger_id` IS NULL AND `taggings`.`context` = 'famous' AND `taggings`.`tag_id` IN (NULL) AND (`taggings`.taggable_id = 1363 AND `taggings`.taggable_type = 'Restaurant')
[paperclip] Saving attachments.
^[[1m^[[36mSQL (54.6ms)^[[0m ^[[1mCOMMIT^[[0m
^[[1m^[[35mSQL (0.1ms)^[[0m BEGIN
^[[1m^[[36mSQL (0.1ms)^[[0m ^[[1mROLLBACK^[[0m
Completed 500 Internal Server Error in 225ms
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
app/controllers/restaurants_controller.rb:276:in `block in update'
app/controllers/restaurants_controller.rb:275:in `update'
+1
Is this error still a problem?
I'm closing this one. If you can come back with full stack trace that'd be great.
I have the same issue writing files to s3 with utf8 filenames and aws-sdk:
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:280:in `inspect'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:280:in `summarize_value'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:267:in `block in summarize_hash'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:266:in `each'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:266:in `map'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:266:in `summarize_hash'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:195:in `_options'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `block in format'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `gsub'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `format'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:303:in `log_response'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:294:in `log_client_request'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:363:in `block in client_request'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:275:in `return_or_raise'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:362:in `client_request'
(eval):3:in `put_object'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/s3/s3_object.rb:315:in `write'
[GEM_ROOT]/bundler/gems/paperclip-3831498f39e2/lib/paperclip/storage/s3.rb:286:in `block in flush_writes'
[GEM_ROOT]/bundler/gems/paperclip-3831498f39e2/lib/paperclip/storage/s3.rb:272:in `each'
[GEM_ROOT]/bundler/gems/paperclip-3831498f39e2/lib/paperclip/storage/s3.rb:272:in `flush_writes'
[GEM_ROOT]/bundler/gems/paperclip-3831498f39e2/lib/paperclip/attachment.rb:197:in `save'
[GEM_ROOT]/bundler/gems/paperclip-3831498f39e2/lib/paperclip/attachment.rb:280:in `reprocess!'
app/models/image.rb:135:in `reprocess_data'
PS: reverting to paperclip 3.0.0 solves the issue
This should be re-opened. I also experience this in the latest master.
Reopen as requested. I'll take a look at it this weekend.
[ThumbnailingWorker] [2012-04-26 13:20:06 -0400] [Attachment] [231495] #<Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8>
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client_logging.rb:126:in `join'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client_logging.rb:126:in `sanitize_hash'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client_logging.rb:43:in `sanitize_options'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client_logging.rb:63:in `log_client_request_on_success'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client_logging.rb:34:in `log_client_request'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client.rb:323:in `block in client_request'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client.rb:260:in `return_or_raise'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/core/client.rb:322:in `client_request'
(eval):3:in `put_object'
/usr/lib64/ruby/gems/1.9.1/gems/aws-sdk-1.3.6/lib/aws/s3/s3_object.rb:315:in `write'
/usr/lib64/ruby/gems/1.9.1/gems/paperclip-3.0.2.1/lib/paperclip/storage/s3.rb:286:in `block in flush_writes'
/usr/lib64/ruby/gems/1.9.1/gems/paperclip-3.0.2.1/lib/paperclip/storage/s3.rb:272:in `each'
/usr/lib64/ruby/gems/1.9.1/gems/paperclip-3.0.2.1/lib/paperclip/storage/s3.rb:272:in `flush_writes'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:491:in `block in flush_writes_with_trace_Paperclip_Storage_flush_writes'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:486:in `flush_writes_with_trace_Paperclip_Storage_flush_writes'
/usr/lib64/ruby/gems/1.9.1/gems/paperclip-3.0.2.1/lib/paperclip/attachment.rb:197:in `save'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:491:in `block in save_with_trace_Paperclip_name_save'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/usr/lib64/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:486:in `save_with_trace_Paperclip_name_save'
/usr/lib64/ruby/gems/1.9.1/gems/paperclip-3.0.2.1/lib/paperclip/attachment.rb:284:in `reprocess!'
I think I resolved this by adding a custom inspect method to each of the file adapters, which just outputs the adapter type and orignal filename instead of relying on Kernel#inspect.
Oh, yeah, seems like that's the problem at aws/sdk
. I think they're trying to mixin the UTF 8 character (which is coming from Paperclip) with their string. I think this issue should be fixed upstream though, not from Paperclip side (unless if Paperclip actually returns ASCII encoding in #inspect, then that's the issue.)
Paperclip doesn't define an inspect method on any of the file adapters, which there is no harm/risk in doing, and it's the result of Kernel#inspect that's ultimately triggering the encoding error
I can reproduce the error and have fixed this one in 784717b8. This one is really a tricky one, as I personally never turn the AWS logging on.
Thank you so much for reporting in.
paperclip3.0.3
when uploaded file with a chinese name, upload file is successful, but resize image is failed.
[paperclip] An error was received while processing: Paperclip::Errors::NotIdentifiedByImageMagickError: C:/Users/outman/AppData/Local/Temp/[图]飘逸长裙.png20120506-5780-ysdukm is not recognized by the 'identify' command.
it goes well with english file name. ^)^
Do you mind open up another issue with the log? I think this might be an os specific issue, and want to investigate this.
Already open #853. Let's discuss it in there.
Hi all. I think that problem in the following method: https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/core/log_formatter.rb#L280 This method of Kernel#inspect, and paperclip or aws not guilty.
We apply the following "dirty hack" for s3:
class Foo < ActiveRecord::Base
has_attached_file :image
def image=(image)
self.image.assign image.tempfile
end
end
I've already fixed it and release 3.0.3. Was that solve your problem?
Hi sikachu, you mean the following patch?
# Overriding AWS::Core::LogFormatter to make sure it return a UTF-8 string
if AWS::VERSION >= "1.3.9"
AWS::Core::LogFormatter.class_eval do
def summarize_hash(hash)
hash.map { |key, value| ":#{key}=>#{summarize_value(value)}".force_encoding('UTF-8') }.sort.join(',')
end
end
else
AWS::Core::ClientLogging.class_eval do
def sanitize_hash(hash)
hash.map { |key, value| "#{sanitize_value(key)}=>#{sanitize_value(value)}".force_encoding('UTF-8') }.sort.join(',')
end
end
end
Yes. I need to force_encoding them to utf-8, as #inspect returns an ascii string. If you're using Paperclip 3.0.3, you should not see that problem anymore.
Yes, we're using Paperclip 3.0.3. Filename for uploading: твиттер.jpg
Exception: Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT)
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:280:in `inspect'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:280:in `summarize_value'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `block in summarize_hash'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `each'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `map'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `summarize_hash'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:195:in `_options'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `block in format'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `gsub'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `format'
aws-sdk (1.4.1) lib/aws/core/client.rb:303:in `log_response'
aws-sdk (1.4.1) lib/aws/core/client.rb:294:in `log_client_request'
aws-sdk (1.4.1) lib/aws/core/client.rb:363:in `block in client_request'
aws-sdk (1.4.1) lib/aws/core/client.rb:275:in `return_or_raise'
aws-sdk (1.4.1) lib/aws/core/client.rb:362:in `client_request'
(eval):3:in `put_object'
aws-sdk (1.4.1) lib/aws/s3/s3_object.rb:315:in `write'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:301:in `block in flush_writes'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:287:in `each'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:287:in `flush_writes'
paperclip (3.0.3) lib/paperclip/attachment.rb:200:in `save'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:17:in `block in save_attached_files'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:10:in `block in each_attachment'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:9:in `each'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:9:in `each_attachment'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:16:in `save_attached_files'
Oh noes. Can I see your stacktrace? What did I miss ...
Check this: lib/aws/core/log_formatter.rb:280
# @param [Object] value
# @return [String]
def summarize_value value
case value
when String then summarize_string(value)
when Hash then '{' + summarize_hash(value) + '}'
when Array then summarize_array(value)
when File then summarize_file(value.path)
when Pathname then summarize_file(value)
else value.inspect # <- This
end
end
Here you are:
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:280:in `inspect'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:280:in `summarize_value'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `block in summarize_hash'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `each'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `map'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:97:in `summarize_hash'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:195:in `_options'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `block in format'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `gsub'
aws-sdk (1.4.1) lib/aws/core/log_formatter.rb:169:in `format'
aws-sdk (1.4.1) lib/aws/core/client.rb:303:in `log_response'
aws-sdk (1.4.1) lib/aws/core/client.rb:294:in `log_client_request'
aws-sdk (1.4.1) lib/aws/core/client.rb:363:in `block in client_request'
aws-sdk (1.4.1) lib/aws/core/client.rb:275:in `return_or_raise'
aws-sdk (1.4.1) lib/aws/core/client.rb:362:in `client_request'
(eval):3:in `put_object'
aws-sdk (1.4.1) lib/aws/s3/s3_object.rb:315:in `write'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:301:in `block in flush_writes'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:287:in `each'
paperclip (3.0.3) lib/paperclip/storage/s3.rb:287:in `flush_writes'
paperclip (3.0.3) lib/paperclip/attachment.rb:200:in `save'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:17:in `block in save_attached_files'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:10:in `block in each_attachment'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:9:in `each'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:9:in `each_attachment'
paperclip (3.0.3) lib/paperclip/instance_methods.rb:16:in `save_attached_files'
activesupport (3.2.3) lib/active_support/callbacks.rb:442:in `_run__2455898094380536020__save__4514752337291452503__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.3) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.2.3) lib/active_record/persistence.rb:84:in `save'
activerecord (3.2.3) lib/active_record/validations.rb:50:in `save'
activerecord (3.2.3) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.2.3) lib/active_record/transactions.rb:241:in `block (2 levels) in save'
activerecord (3.2.3) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.3) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.3) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.2.3) lib/active_record/transactions.rb:241:in `block in save'
activerecord (3.2.3) lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
activerecord (3.2.3) lib/active_record/transactions.rb:240:in `save'
app/controllers/admin/collections_controller.rb:18:in `create'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.3) lib/active_support/callbacks.rb:437:in `block in _run__3368247988634076389__process_action__2304501602405600008__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_359'
activesupport (3.2.3) lib/active_support/callbacks.rb:326:in `around'
activesupport (3.2.3) lib/active_support/callbacks.rb:310:in `_callback_around_293'
activesupport (3.2.3) lib/active_support/callbacks.rb:214:in `_conditional_callback_around_359'
activesupport (3.2.3) lib/active_support/callbacks.rb:436:in `_run__3368247988634076389__process_action__2304501602405600008__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/rack.rb:27:in `call'
sass (3.1.10) lib/sass/plugin/rack.rb:54:in `call'
lib/bulova_dispatcher.rb:12:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__1187761922037910251__call__4514752337291452503__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
rack (1.4.1) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/user_informer.rb:12:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.1) lib/rack/deflater.rb:13:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/pavel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/pavel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/pavel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
The code without exception:
# @param [Object] value
# @return [String]
def summarize_value value
case value
when String then summarize_string(value)
when Hash then '{' + summarize_hash(value) + '}'
when Array then summarize_array(value)
when File then summarize_file(value.path)
when Pathname then summarize_file(value)
else value.to_s.force_encoding('UTF-8').inspect
end
end
Hmm .. yeah, I couldn't reproduce the error on the #inspect
line. I think in that case we should override Kernel#inspect. Going to work on this on Friday.
Anything new on this Issue?
concerning the aws-sdk logger, you can fix the problem by turning off its logger :
# in your RAILS_ROOT/config/initializers/aws-sdk.rb
AWS.config(:logger => nil)
This worked for me. More information here.
thanks a lot! i will check this out..
same problem. stack trace was quite large, so I put it into a gist. https://gist.github.com/2876942
note: we're not using the filename in the path. we create a uuid
.
has_attached_file :file,
:path => "#{Rails.root}/public/system/files/book/:uuid.:extension",
:url => "/system/files/book/:uuid.:extension",
:storage => Rails.application.config.paperclip_storage,
:bucket => Rails.application.config.aws_bucket_name,
:s3_credentials =>
{
:access_key_id => Rails.application.config.aws_access_key,
:secret_access_key => Rails.application.config.aws_secret
}
If someone can recommend the proper place to put the a sanitize method, I'd be happy to use that. I am using Active Admin to generate the form which then submits via Paperclip to Amazon S3. I suppose I could override the Active Admin create/update controller methods and attempt to sanitize there? but that seems less than ideal. It seems like I should do it inside of Paperclip or aws-sdk, if possible.
setting AWS.config( :logger => nil )
worked (obviously, since it no longer tries to report something)
I've added this monkey patch on my project to fix the problem: https://gist.github.com/2902006
Using S3 and paperclip 3.0.4, I had the same issue (jérémie.jpg fails, jeremie.jpg works). I tried AWS.config( :logger => nil ), it did not work xaviercronus, your dirty hack works for me, thanks !
Resize image still failing.... I guess I will move to carrierwave, because this bug is alive for almost a year and I dont see it working with utf-8
@luccasmaso if Carrierwave works for you, then that's fine. I'm still fixing this issue and haven't gave up.
I currently wait on @phene on #923.
@xaviercronus while would make it work now, it's too obtrusive and would break if aws-s3
decides to change that method signature. That's why I'm leaning on adding AbstractAdapter#inspect
to return UTF-8
string.
Any updates please tell us (=
I've released v3.1.3 with the #inspect
fix. Please give it a try. @luccasmaso
Thanks @sikachu! It works!
Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8): app/controllers/photos_controller.rb:63:in
block in create' app/controllers/photos_controller.rb:60:in
each' app/controllers/photos_controller.rb:60:in `create'Rendered /Users/jason/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms) Rendered /Users/jason/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (7.2ms) Rendered /Users/jason/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (13.8ms)