Ruby 1.9 + MySQL Hack
The default encoding in MySQL is latin1. Ruby 1.9 is a stickler about the encoding of a sequence of bytes. In this case, a utf8 page name stored in the database comes back as "ASCII-8BIT" (ie, binary). Coerce that back to utf8. This doesn't affect SQLite3, and it doesn't affect Ruby 1.8. It doesn't even affect MySQL databases with "utf8" encoding (though that has other issues, since MySQL's utf8 support is broken). There are probably other, similar problems lurking.
This commit is contained in:
parent
e3aa626489
commit
d786e95a77
1 changed files with 1 additions and 1 deletions
|
@ -82,7 +82,7 @@ class Page < ActiveRecord::Base
|
|||
|
||||
# Returns the original wiki-word name as separate words, so "MyPage" becomes "My Page".
|
||||
def plain_name
|
||||
web.brackets_only? ? CGI.escapeHTML(name) : CGI.escapeHTML(WikiWords.separate(name))
|
||||
web.brackets_only? ? CGI.escapeHTML(name).as_utf8 : CGI.escapeHTML(WikiWords.separate(name)).as_utf8
|
||||
end
|
||||
|
||||
LOCKING_PERIOD = 30.minutes
|
||||
|
|
Loading…
Reference in a new issue