I was just testing my site and I copied and pasted some text from another page into my user profile. When I clicked update
, I got a 500:
Encoding::UndefinedConversio开发者_如何转开发nError: U+201C from UTF-8 to ISO-8859-1
The offending character turned out to be a simple "
. What should I do to make my form less vulnerable to copying and pasting, which I imagine many users in my situation will be doing?
The real error here is that you're not using UTF-8 somewhere, probably in your database. Make sure your database is UTF-8 encoded for maximum compatibility. (Also, if for some reason you've setup Rails to use something other than UTF-8 for encoding, I'd highly recommend using UTF-8 instead, there's very rarely any good reason not to.)
精彩评论