invalid byte sequence in UTF-8 on page request

后端 未结 4 1040
走了就别回头了
走了就别回头了 2021-01-06 12:24

I\'m getting \"invalid byte sequence in UTF-8\" on page requests (permalinks) and I have no idea why nor can I reproduce it but I do get a lot of exceptions like this:

4条回答
  •  长发绾君心
    2021-01-06 13:08

    we created a rails middleware that filters out all the strange encodings that can not be handled within our app.

    the problem that we encounter is that there are requests that have strange encodings, for example Cp1252 / Windows-1252. when ruby 1.9 tries to match those strings against utf-8 regexps it blows up.

    i tried various ways of dealing with this problem by using iconv, but it looks like solutions that work on my mac don't work on the servers. so the simplest approach is probably the best...

提交回复
热议问题