开发者

500 encoding error when user copies and pastes 'unusual' characters

开发者 https://www.devze.com 2023-02-16 21:22 出处:网络
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:

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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消