jywarren / plots2

The Public Lab website!
http://publiclab.org
GNU General Public License v3.0
17 stars 2 forks source link

some pages' image descriptions result in error due to non-UTF-8 content #196

Closed jywarren closed 10 years ago

jywarren commented 11 years ago

http://publiclab.org/notes/eblaine/4-13-2013/kite-mapping-central-america-waste-and-recycling

yields:

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
58:    <div id="lightbox-<%= image.fid %>" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true">
59:         <div class='lightbox-content'>
60:                 <img src="<%= image.image.path(:original) %>">
61:                 <div class="lightbox-caption"><p><%= image.description %></p></div>
62:         </div>
63:     </div> 
64:   app/views/notes/show.html.erb:61:in `block in _app_views_notes_show_html_erb___387671360501422718_47949680'

In-depth discussion of the issue here: http://yehudakatz.com/2010/05/05/ruby-1-9-encodings-a-primer-and-the-solution-for-rails/ which i haven't read thoroughly

I'm inserting: .force_encoding("UTF-8") and testing now.

jywarren commented 11 years ago

That threw: incompatible character encodings: UTF-8 and ASCII-8BIT

oh well... i'll have to actually read the discussion i linked to... but not on friday night!

jywarren commented 10 years ago

This is still unresolved, but I suspect it was related to the use of accent characters, for some reason, perhaps posted from a spanish language computer with non-UTF-8 encoding? I was finally able to get the note to show by removing all accented characters (using "Transliterate selection to ASCII" in TextMate). I'll try to re-add them in the edit form now, but closing as we haven't seen this on any other post.

jywarren commented 10 years ago

Strangely, I can add accents on other posts. Maybe somehow the record itself has encoding stored... i wonder if we can change that at all, or force an encoding on save...

btbonval commented 10 years ago

That's weird. Most things in mysql seem to be table specific, so if one note entry in the table supports utf8, all note entries in the same table should support it. On Apr 29, 2014 11:28 AM, "Jeffrey Warren" notifications@github.com wrote:

Strangely, I can add accents on other posts. Maybe somehow the record itself has encoding stored... i wonder if we can change that at all, or force an encoding on save...

— Reply to this email directly or view it on GitHubhttps://github.com/jywarren/plots2/issues/196#issuecomment-41691106 .