不兼容的字符编码:ASCII-8BIT和UTF-8(incompatible character encodings: ASCII-8BIT and UTF-8)
我使用Ruby 1.9.2和Rails 3.0.5
我有以下错误:
不兼容的字符编码:ASCII-8BIT和UTF-8
它与我认为的数据库无关。
这个错误是在一个视图中的这一行上打嗝(只是一个div haml调用):
#content
全堆:
ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8): 21: -flash.each do |name, msg| 22: =content_tag :div, msg, :id => "flash_#{name}" 23: %div.clear 24: #content 25: = yield 26: = render :partial => "layouts/grid_right" if render_grid_right? 27: = render :partial => "layouts/footer" app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___4380000789490545718_2180251300_2717546578298801795' actionpack (3.0.5) lib/action_view/template.rb:135:in `block in render' activesupport (3.0.5) lib/active_support/notifications.rb:54:in `instrument' actionpack (3.0.5) lib/action_view/template.rb:127:in `render' actionpack (3.0.5) lib/action_view/render/layouts.rb:80:in `_render_layout' actionpack (3.0.5) lib/action_view/render/rendering.rb:62:in `block in _render_template' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `block in instrument' activesupport (3.0.5) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `instrument' actionpack (3.0.5) lib/action_view/render/rendering.rb:56:in `_render_template' actionpack (3.0.5) lib/action_view/render/rendering.rb:26:in `render' haml (3.0.25) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml' actionpack (3.0.5) lib/abstract_controller/rendering.rb:115:in `_render_template' actionpack (3.0.5) lib/abstract_controller/rendering.rb:109:in `render_to_body' actionpack (3.0.5) lib/action_controller/metal/renderers.rb:47:in `render_to_body' actionpack (3.0.5) lib/action_controller/metal/compatibility.rb:55:in `render_to_body' actionpack (3.0.5) lib/abstract_controller/rendering.rb:102:in `render_to_string' actionpack (3.0.5) lib/abstract_controller/rendering.rb:93:in `render' actionpack (3.0.5) lib/action_controller/metal/rendering.rb:17:in `render' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render' activesupport (3.0.5) lib/active_support/core_ext/benchmark.rb:5:in `block in ms' /Users/michaelkoper/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' activesupport (3.0.5) lib/active_support/core_ext/benchmark.rb:5:in `ms' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:40:in `block in render' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime' activerecord (3.0.5) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:39:in `render' actionpack (3.0.5) lib/action_controller/metal/implicit_render.rb:10:in `default_render' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:261:in `block in retrieve_response_from_mimes' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:192:in `call' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:192:in `respond_to' app/controllers/home_controller.rb:9:in `index' actionpack (3.0.5) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (3.0.5) lib/abstract_controller/base.rb:150:in `process_action' actionpack (3.0.5) lib/action_controller/metal/rendering.rb:11:in `process_action' actionpack (3.0.5) lib/abstract_controller/callbacks.rb:18:in `block in process_action' activesupport (3.0.5) lib/active_support/callbacks.rb:445:in `_run__3968431659371141392__process_action__3163094469870857953__callbacks' activesupport (3.0.5) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks' activesupport (3.0.5) lib/active_support/callbacks.rb:93:in `run_callbacks' actionpack (3.0.5) lib/abstract_controller/callbacks.rb:17:in `process_action' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `block in instrument' activesupport (3.0.5) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `instrument' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:29:in `process_action' actionpack (3.0.5) lib/action_controller/metal/rescue.rb:17:in `process_action' actionpack (3.0.5) lib/abstract_controller/base.rb:119:in `process' actionpack (3.0.5) lib/abstract_controller/rendering.rb:41:in `process' actionpack (3.0.5) lib/action_controller/metal.rb:138:in `dispatch' actionpack (3.0.5) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' actionpack (3.0.5) lib/action_controller/metal.rb:178:in `block in action' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:62:in `call' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:62:in `dispatch' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:27:in `call' rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize' rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:492:in `call' haml (3.0.25) lib/sass/plugin/rack.rb:41:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/head.rb:14:in `call' rack (1.2.1) lib/rack/methodoverride.rb:24:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/params_parser.rb:21:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/flash.rb:182:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/cookies.rb:302:in `call' activerecord (3.0.5) lib/active_record/query_cache.rb:32:in `block in call' activerecord (3.0.5) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache' activerecord (3.0.5) lib/active_record/query_cache.rb:12:in `cache' activerecord (3.0.5) lib/active_record/query_cache.rb:31:in `call' activerecord (3.0.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call' activesupport (3.0.5) lib/active_support/callbacks.rb:415:in `_run_call_callbacks' actionpack (3.0.5) lib/action_dispatch/middleware/callbacks.rb:44:in `call' rack (1.2.1) lib/rack/sendfile.rb:107:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/remote_ip.rb:48:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' railties (3.0.5) lib/rails/rack/logger.rb:13:in `call' rack (1.2.1) lib/rack/runtime.rb:17:in `call' activesupport (3.0.5) lib/active_support/cache/strategy/local_cache.rb:72:in `call' rack (1.2.1) lib/rack/lock.rb:11:in `block in call' <internal:prelude>:10:in `synchronize' rack (1.2.1) lib/rack/lock.rb:11:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/static.rb:30:in `call' railties (3.0.5) lib/rails/application.rb:168:in `call' railties (3.0.5) lib/rails/application.rb:77:in `method_missing' railties (3.0.5) lib/rails/rack/log_tailer.rb:14:in `call' rack (1.2.1) lib/rack/content_length.rb:13:in `call' rack (1.2.1) lib/rack/chunked.rb:15:in `call' rack (1.2.1) lib/rack/handler/mongrel.rb:67:in `process' mongrel (1.2.0.pre2) lib/mongrel.rb:165:in `block in process_client' mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `each' mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `process_client' mongrel (1.2.0.pre2) lib/mongrel.rb:291:in `block (2 levels) in run'
我的宝石:
Using rake (0.8.7) Using RedCloth (4.2.2) Using abstract (1.0.0) Using activesupport (3.0.5) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.5) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.7) Using tzinfo (0.3.24) Using actionpack (3.0.5) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.15) Using actionmailer (3.0.5) Using arel (2.0.9) Using activerecord (3.0.5) Using activeresource (3.0.5) Using authlogic (2.1.6) Using xml-simple (1.0.14) Using aws-s3 (0.6.2) Using block_helpers (0.3.3) Using bundler (1.0.10) Using diff-lcs (1.1.2) Using json (1.4.6) Using gherkin (2.3.4) Using term-ansicolor (1.0.5) Using cucumber (0.10.0) Using cucumber-rails (0.3.2) Using daemons (1.0.10) Using database_cleaner (0.6.5) Using factory_girl (1.3.3) Using faker (0.9.5) Using formtastic (1.2.3) Using gem_plugin (0.2.3) Using haml (3.0.25) Using thor (0.14.6) Using railties (3.0.5) Using rails (3.0.5) Using kaminari (0.10.4) Using mongrel (1.2.0.pre2) Using mysql2 (0.2.6) Using nokogiri (1.4.4) Using paperclip (2.3.8) Using rspec-core (2.5.1) Using rspec-expectations (2.5.0) Using rspec-mocks (2.5.0) Using rspec (2.5.0) Using yard (0.6.4) Using pickle (0.4.4) Using populator (1.0.0) Using rspec-rails (2.5.0) Using webrat (0.7.3)
I use Ruby 1.9.2 and Rails 3.0.5
I have the following error:
incompatible character encodings: ASCII-8BIT and UTF-8
It has nothing to do with the database i think.
The error is happinging on this line in a view (just a div haml call):
#content
full stack:
ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8): 21: -flash.each do |name, msg| 22: =content_tag :div, msg, :id => "flash_#{name}" 23: %div.clear 24: #content 25: = yield 26: = render :partial => "layouts/grid_right" if render_grid_right? 27: = render :partial => "layouts/footer" app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___4380000789490545718_2180251300_2717546578298801795' actionpack (3.0.5) lib/action_view/template.rb:135:in `block in render' activesupport (3.0.5) lib/active_support/notifications.rb:54:in `instrument' actionpack (3.0.5) lib/action_view/template.rb:127:in `render' actionpack (3.0.5) lib/action_view/render/layouts.rb:80:in `_render_layout' actionpack (3.0.5) lib/action_view/render/rendering.rb:62:in `block in _render_template' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `block in instrument' activesupport (3.0.5) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `instrument' actionpack (3.0.5) lib/action_view/render/rendering.rb:56:in `_render_template' actionpack (3.0.5) lib/action_view/render/rendering.rb:26:in `render' haml (3.0.25) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml' actionpack (3.0.5) lib/abstract_controller/rendering.rb:115:in `_render_template' actionpack (3.0.5) lib/abstract_controller/rendering.rb:109:in `render_to_body' actionpack (3.0.5) lib/action_controller/metal/renderers.rb:47:in `render_to_body' actionpack (3.0.5) lib/action_controller/metal/compatibility.rb:55:in `render_to_body' actionpack (3.0.5) lib/abstract_controller/rendering.rb:102:in `render_to_string' actionpack (3.0.5) lib/abstract_controller/rendering.rb:93:in `render' actionpack (3.0.5) lib/action_controller/metal/rendering.rb:17:in `render' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render' activesupport (3.0.5) lib/active_support/core_ext/benchmark.rb:5:in `block in ms' /Users/michaelkoper/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' activesupport (3.0.5) lib/active_support/core_ext/benchmark.rb:5:in `ms' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:40:in `block in render' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime' activerecord (3.0.5) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:39:in `render' actionpack (3.0.5) lib/action_controller/metal/implicit_render.rb:10:in `default_render' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:261:in `block in retrieve_response_from_mimes' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:192:in `call' actionpack (3.0.5) lib/action_controller/metal/mime_responds.rb:192:in `respond_to' app/controllers/home_controller.rb:9:in `index' actionpack (3.0.5) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (3.0.5) lib/abstract_controller/base.rb:150:in `process_action' actionpack (3.0.5) lib/action_controller/metal/rendering.rb:11:in `process_action' actionpack (3.0.5) lib/abstract_controller/callbacks.rb:18:in `block in process_action' activesupport (3.0.5) lib/active_support/callbacks.rb:445:in `_run__3968431659371141392__process_action__3163094469870857953__callbacks' activesupport (3.0.5) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks' activesupport (3.0.5) lib/active_support/callbacks.rb:93:in `run_callbacks' actionpack (3.0.5) lib/abstract_controller/callbacks.rb:17:in `process_action' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `block in instrument' activesupport (3.0.5) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.0.5) lib/active_support/notifications.rb:52:in `instrument' actionpack (3.0.5) lib/action_controller/metal/instrumentation.rb:29:in `process_action' actionpack (3.0.5) lib/action_controller/metal/rescue.rb:17:in `process_action' actionpack (3.0.5) lib/abstract_controller/base.rb:119:in `process' actionpack (3.0.5) lib/abstract_controller/rendering.rb:41:in `process' actionpack (3.0.5) lib/action_controller/metal.rb:138:in `dispatch' actionpack (3.0.5) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' actionpack (3.0.5) lib/action_controller/metal.rb:178:in `block in action' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:62:in `call' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:62:in `dispatch' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:27:in `call' rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize' rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call' actionpack (3.0.5) lib/action_dispatch/routing/route_set.rb:492:in `call' haml (3.0.25) lib/sass/plugin/rack.rb:41:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/head.rb:14:in `call' rack (1.2.1) lib/rack/methodoverride.rb:24:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/params_parser.rb:21:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/flash.rb:182:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/cookies.rb:302:in `call' activerecord (3.0.5) lib/active_record/query_cache.rb:32:in `block in call' activerecord (3.0.5) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache' activerecord (3.0.5) lib/active_record/query_cache.rb:12:in `cache' activerecord (3.0.5) lib/active_record/query_cache.rb:31:in `call' activerecord (3.0.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call' activesupport (3.0.5) lib/active_support/callbacks.rb:415:in `_run_call_callbacks' actionpack (3.0.5) lib/action_dispatch/middleware/callbacks.rb:44:in `call' rack (1.2.1) lib/rack/sendfile.rb:107:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/remote_ip.rb:48:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' railties (3.0.5) lib/rails/rack/logger.rb:13:in `call' rack (1.2.1) lib/rack/runtime.rb:17:in `call' activesupport (3.0.5) lib/active_support/cache/strategy/local_cache.rb:72:in `call' rack (1.2.1) lib/rack/lock.rb:11:in `block in call' <internal:prelude>:10:in `synchronize' rack (1.2.1) lib/rack/lock.rb:11:in `call' actionpack (3.0.5) lib/action_dispatch/middleware/static.rb:30:in `call' railties (3.0.5) lib/rails/application.rb:168:in `call' railties (3.0.5) lib/rails/application.rb:77:in `method_missing' railties (3.0.5) lib/rails/rack/log_tailer.rb:14:in `call' rack (1.2.1) lib/rack/content_length.rb:13:in `call' rack (1.2.1) lib/rack/chunked.rb:15:in `call' rack (1.2.1) lib/rack/handler/mongrel.rb:67:in `process' mongrel (1.2.0.pre2) lib/mongrel.rb:165:in `block in process_client' mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `each' mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `process_client' mongrel (1.2.0.pre2) lib/mongrel.rb:291:in `block (2 levels) in run'
My gems:
Using rake (0.8.7) Using RedCloth (4.2.2) Using abstract (1.0.0) Using activesupport (3.0.5) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.5) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.7) Using tzinfo (0.3.24) Using actionpack (3.0.5) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.15) Using actionmailer (3.0.5) Using arel (2.0.9) Using activerecord (3.0.5) Using activeresource (3.0.5) Using authlogic (2.1.6) Using xml-simple (1.0.14) Using aws-s3 (0.6.2) Using block_helpers (0.3.3) Using bundler (1.0.10) Using diff-lcs (1.1.2) Using json (1.4.6) Using gherkin (2.3.4) Using term-ansicolor (1.0.5) Using cucumber (0.10.0) Using cucumber-rails (0.3.2) Using daemons (1.0.10) Using database_cleaner (0.6.5) Using factory_girl (1.3.3) Using faker (0.9.5) Using formtastic (1.2.3) Using gem_plugin (0.2.3) Using haml (3.0.25) Using thor (0.14.6) Using railties (3.0.5) Using rails (3.0.5) Using kaminari (0.10.4) Using mongrel (1.2.0.pre2) Using mysql2 (0.2.6) Using nokogiri (1.4.4) Using paperclip (2.3.8) Using rspec-core (2.5.1) Using rspec-expectations (2.5.0) Using rspec-mocks (2.5.0) Using rspec (2.5.0) Using yard (0.6.4) Using pickle (0.4.4) Using populator (1.0.0) Using rspec-rails (2.5.0) Using webrat (0.7.3)
最满意答案
我怀疑您将Haml模板的一部分复制/粘贴到文件中,或者正在使用非Unicode /非UTF-8友好的编辑器。
看看您是否可以在UTF-8友好的编辑器中从头开始重新创建该文件。 有很多任何平台,看看这是否解决了你的问题。 首先用
#content
擦除行并手动重新键入。I have a suspicion that you either copy/pasted a part of your Haml template into the file, or you're working with a non-Unicode/non-UTF-8 friendly editor.
See if you can recreate that file from the scratch in a UTF-8 friendly editor. There are plenty for any platform and see whether this fixes your problem. Start by erasing the line with
#content
and retyping it manually.
相关问答
更多-
好吧,所以问题解决了几个小时后Google ... 我的代码中实际存在两个错误。 第一个是文件编码错误,第二个是MySQL数据库配置的问题。 首先,解决MySQL导致的错误我使用了这两篇文章: http://www.dotkam.com/2008/09/14/configure-rails-and-mysql-to-support-utf-8/ http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/ 其次,为了解决文件编码问题,我在config ...
-
欺骗是正确的,即ISO8859-1(AKA Latin-1)编码文本。 尝试这个: file_contents = CSV.read("csvfile.csv", col_sep: "$", encoding: "ISO8859-1") 如果这不行,可以使用Iconv来修复单个字符串,如下所示: require 'iconv' utf8_string = Iconv.iconv('utf-8', 'iso8859-1', latin1_string).first 如果"Non sp\xE9cifi\xE ...
-
rails不兼容的字符编码:json中的UTF-8和ASCII-8BIT(rails incompatible character encodings: UTF-8 and ASCII-8BIT in json)[2022-06-25]
添加此行后解决 @output = @output.force_encoding('utf-8').encode Solved after adding this line @output = @output.force_encoding('utf-8').encode -
我怀疑您将Haml模板的一部分复制/粘贴到文件中,或者正在使用非Unicode /非UTF-8友好的编辑器。 看看您是否可以在UTF-8友好的编辑器中从头开始重新创建该文件。 有很多任何平台,看看这是否解决了你的问题。 首先用#content擦除行并手动重新键入。 I have a suspicion that you either copy/pasted a part of your Haml template into the file, or you're working with a non-Uni ...
-
我发现添加了 # encoding: utf-8 在开始时更简单(可能更优雅) I found out that adding # encoding: utf-8 at the beginning is much simpler (and possibly more elegant)
-
检查你的linux语言环境。 跑一个 dpkg-reconfigure locales 检查您的区域设置 Generating locales (this might take a while)... fr_FR.UTF-8... done 删除你的redmine缓存 mv /path/to/redmine/tmp /path/to/redmine/tmp_OLD mkdir /path/to/redmine/tmp chown youruser /path/to/redmine/tmp 重新启动r ...
-
我从来没有对此进行整理,我真的不愿意接受这种解决方法作为答案,但是当没有其他人可以提供任何东西时,请大家好。 作为一种解决方法,因为我正在加载整个数据库,所以我只是将production.sqlite从开发框移到了生产框中。 这对我来说不太合适,但也许我只是偏执狂。 无论哪种方式,它都有效,现在一切都在顺利进行。 I never sorted this out and I'd really rather not accept this workaround as the answer, but when n ...
-
将您的httparty gem降级为0.14版本: https://github.com/jnunemaker/httparty/issues/533 Downgrade your httparty gem to 0.14 version: https://github.com/jnunemaker/httparty/issues/533
-
我已经找到了问题,问题是我在(app / view / layouts /)_footer.html.erb中添加了下面列出的以下源代码
不兼容的字符编码:Oga gem中的ASCII-8BIT和UTF-8(incompatible character encodings: ASCII-8BIT and UTF-8 in Oga gem)[2022-12-23]
您链接的代码与毛刺无关,即正在解决错误编码的问题。 在解析文档之前尝试添加body = body.force_encoding 'UTF-8' : def get_page body = Net::HTTP.get(URI.parse(@url)).force_encoding 'UTF-8' document = Oga.parse_html(body) end The bit of code you linked has nothing to do with the glitch, that ...相关文章
更多- Setting up Nutch 2.1 with MySQL to handle UTF-8
- [JAVA] IOException: Invalid byte 2 of 2-byte UTF-8 sequence(解决办法)
- Java Character类
- Guava ASCII字符转换 CaseFormat类
- 启动Solr服务报错:Path must not end with / character
- 关于sql中bit位的查询
- 用java把“真”这个字符转换为十六进制为“771f”,这是ascii还是unicode
- tomcat设置成utf8,怎样确保从用户手动在浏览器里输入的url中的中文参数
- js判断ascii的码值
- 关于如何将utf8转换为gb2312的问题
最新问答
更多- 在javascript中创建类以创建对象并在Java中创建类和对象之间的区别(Difference between creating a class in javascript to create an object and creating an class and object in Java)
- Facebook API:将身份验证详细信息从Javascript SDK发送到PHP SDK(Facebook API: Send authentication detail from Javascript SDK to PHP SDK)
- 如何停止队列动画jquery?(How can I stop queue animation jquery?)
- 使用C#的井字游戏中的人工智能(Artificial Intelligence in Tic-Tac-Toe using C#)
- 多少流量可以共享虚拟主机(对于Python Django站点)支持?(How Much Traffic Can Shared Web Hosting (for a Python Django site) support?)
- 带有CIFilters的CAShapeLayer(CAShapeLayer with CIFilters)
- 如何在Angular 2中读取JSON #text(How to read in Angular 2 the JSON #text)
- 如何在xml中读取自闭标签的属性?(How to read self closing tag's attribute in xml?)
- 无法使用http put将图像上传到亚马逊S3(Cannot upload image to amazon s3 using http put)
- 文件结束无限循环(end of file infinite while-loop)
- 在cpp的模板(template in cpp)
- 在构建库时,clang和clang ++有什么区别?(What's the difference between clang and clang++ when building a library?)
- ng类中的表达式(expression inside ng-class)
- 在PHP中获取随机布尔值true / false(Get random boolean true/false in PHP)
- 管道的高效分块用于严格的字节串(Efficient chunking of conduit for strict bytestring)
- Python ternary_operator(如果其他标志做了其他操作,则执行其他操作)(Python ternary_operator (do-somthing if flag else do-another))
- Sencha Touch面具发布(Sencha Touch mask ondisclosure)
- 验证脚本上的通知[重复](Notices on validation script [duplicate])
- 朋友功能(friend function)
- 基于角坐标平移和变换平面几何(Translate and transform plane geometry based on corner coordinates)
- Rails:'如果在本地运行'条件javascript标记包括(Rails: 'if running locally' conditional javascript tag include)
- 解压文件(Unzipping files)
- 使用ui-router以角度加载变量状态(loading in variable states with ui-router in angular)
- 创建Azure云服务需要多长时间?(how long does it take to create an Azure Cloud Service? How to view log information?)
- 指向整数的指针数组(Array of pointers to integers)
- Laravel服务提供商没有看到我的包的主要类(Laravel service provider does not see the main class of my package)
- 这个关于VSS / RSS / PSS / USS的解释是否准确?(Is this explanation about VSS/RSS/PSS/USS accurate?)
- 在Django-Admin中通过row-id排序显示项目(Ordering the display items by row-id in Django-Admin)
- 如何使用cythonize启用`--embed`?(How to enable `--embed` with cythonize?)
- 用于将文本多行设置的Excel脚本(Excel script for ereasing text multiple rows)