diaspora / diaspora

A privacy-aware, distributed, open source social network.
https://diasporafoundation.org/
GNU Affero General Public License v3.0
13.4k stars 2.92k forks source link

Character Encoding Problem #1395

Closed diaspora-redmine-github-migration closed 12 years ago

diaspora-redmine-github-migration commented 13 years ago

Issue 998 from bugs.joindiaspora.com Created by: gene On Wed Apr 6 09:13:52 2011

Priority: High Status: Confirmed

Running in production mode on Debian 5. Everything installed exactly according to wiki.

This problem can be reproduced as follows:

  1. Click 'signup' on 'login' page.
  2. input whatever and then click continue.
  3. in first name and last name, type some east Asian texts. (just in case you can't easily type them on your computer. Here are some for you to use: 中文测试字符)
  4. click next

Got 500 Internal Server Error

Below is the error log:

event=error error_class=ActionView::Template::Error error_message='incompatible character encodings: UTF-8 and ASCII-8BIT' orig_error_message='incompatible character encodings: UTF-8 and ASCII-8BIT'annotated_source=' 50: 51: - for aspect in @all_aspects 52: %li{:data=>{:guid=>aspect.id}, :class => ("selected" if @object_aspect_ids.include?(aspect.id))} 53: = link_for_aspect(aspect, :class => 'aspect_selector name', :title => t('contacts', :count => aspect.contacts.size)) 54: 55: %li 56: = link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect'), :rel => 'facebox' ' app_backtrace='app/helpers/aspects_helper.rb:14:in link_for_aspect';app/views/layouts/_header.html.haml:53:inblock in _app_views_layoutsheader_html_haml106159122879165826_54110380_1269226869283792865';app/views/layouts/_header.html.haml:51:in _app_views_layouts__header_html_haml__106159122879165826_54110380_1269226869283792865';app/views/layouts/application.html.haml:86:in_app_views_layouts_application_html_haml__4267682489909635558_56873300__806859317348752403';app/controllers/users_controller.rb:121:in getting_started';lib/chrome_frame.rb:39:incall''

diaspora-redmine-github-migration commented 13 years ago

Comment by: MrZYX On Wed Apr 6 10:44:56 2011

That's because you use ruby 1.9. I tried several times to fix it but it seems that haml parses the templates as ASCII no matter what you do to say it to parse it as UTF8. Ruby 1.8 seems to just ignore the problem. Anyone knows a fix?

diaspora-redmine-github-migration commented 13 years ago

Comment by: gene On Thu Apr 7 12:59:21 2011

You mean, there is a workaround. And that is downgrade my ruby to 1.8?

diaspora-redmine-github-migration commented 13 years ago

Comment by: MrZYX On Thu Apr 7 14:13:38 2011

gene wrote:

You mean, there is a workaround. And that is downgrade my ruby to 1.8?

yeah, annoying I know.

diaspora-redmine-github-migration commented 13 years ago

Comment by: gene On Thu Apr 7 14:19:08 2011

If so, I guess you should change the 'How to install'.

Instead of installing ruby-1.9.2 for Debian 5, you should suggest 1.8.7 (You are suggesting 1.8.7 for Debian 6. Why 1.9.2 for Debian 5 when it doesn't work for non ascii characters)

This is what I did:

wget ftp://ftp.ruby-lang.org//pub/ruby/ruby-1.8.7-p334.tar.gz tar xzf ruby-1.8.7-p334.tar.gz cd ruby-1.8.7-p334 ./configure --prefix=/usr make make install

It's working now.

diaspora-redmine-github-migration commented 13 years ago

Comment by: MrZYX On Thu Apr 7 18:26:02 2011

It's a wiki, change it :)

diaspora-redmine-github-migration commented 13 years ago

Comment by: sofaer On Thu Apr 7 23:56:00 2011

Maybe we should have some sort of 'awaiting upstream fix' status?

diaspora-redmine-github-migration commented 13 years ago

Comment by: MrZYX On Fri Apr 8 05:10:02 2011

I'm not sure that it isn't our bug, if it is upstream then in haml I think.

Flink commented 13 years ago

Working with haml and ruby 1.9.2, it is not related (not directly at least). I suspect an error with mysql encoding instead. (I have the same error in the console, string.encoding returns #Encoding:ASCII-8BIT)

Flink commented 13 years ago

Ok found it. The default collation for creating the DB is wrong. If you set it to utf8_general_ci instead of utf8_bin, strings are correctly seen as UTF8.

Flink commented 13 years ago

Also this is a duplicate of #100 IMHO

sarahmei commented 12 years ago

This was a database configuration problem and has been fixed (and updated in the wiki). Closing. Please open a new issue if you see any other character encoding issues.