{"action":"created","issue":{"url":"https://api.github.com/repos/ohler55/oj/issues/468","repository_url":"https://api.github.com/repos/ohler55/oj","labels_url":"https://api.github.com/repos/ohler55/oj/issues/468/labels{/name}","comments_url":"https://api.github.com/repos/ohler55/oj/issues/468/comments","events_url":"https://api.github.com/repos/ohler55/oj/issues/468/events","html_url":"https://github.com/ohler55/oj/issues/468","id":313511534,"number":468,"title":"EncodingError: invalid encoding symbol","user":{"login":"rkotov93","id":640137,"avatar_url":"https://avatars2.githubusercontent.com/u/640137?v=4","gravatar_id":"","url":"https://api.github.com/users/rkotov93","html_url":"https://github.com/rkotov93","followers_url":"https://api.github.com/users/rkotov93/followers","following_url":"https://api.github.com/users/rkotov93/following{/other_user}","gists_url":"https://api.github.com/users/rkotov93/gists{/gist_id}","starred_url":"https://api.github.com/users/rkotov93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkotov93/subscriptions","organizations_url":"https://api.github.com/users/rkotov93/orgs","repos_url":"https://api.github.com/users/rkotov93/repos","events_url":"https://api.github.com/users/rkotov93/events{/privacy}","received_events_url":"https://api.github.com/users/rkotov93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-11T22:35:46Z","updated_at":"2018-04-13T09:19:23Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI've met a pretty weird bug using `oj` in rails project with `Oj.optimize_rails` initializer added. So, I have a json with utf-8 encoded field name. Weirdness is that sometimes `Oj` parses it, sometimes \r\nraises `EncodingError: invalid encoding symbol`, but the parsed value is different every time.\r\n\r\n```ruby\r\njson = \"{\\\"s\\\\u0000t\\\\u0000a\\\\u0000t\\\\u0000e\\\":\\\"\\\"}\"\r\n\r\nJSON.parse(json, symbolize_names: true)\r\n#=> {:\"s\\x00\\x00\\x00\\x00\\x00\\x00@?\"=>\"\"}\r\n\r\nJSON.parse(json, symbolize_names: true)\r\n#=> EncodingError: invalid encoding symbol\r\n#=> from (pry):17:in `parse'\r\n\r\nJSON.parse(json, symbolize_names: true)\r\n#=> EncodingError: invalid encoding symbol\r\n#=> from (pry):18:in `parse'\r\n\r\nJSON.parse(json, symbolize_names: true)\r\n#=> EncodingError: invalid encoding symbol\r\n#=> from (pry):19:in `parse'\r\n\r\nJSON.parse(json, symbolize_names: true)\r\n#=> {:\"s\\x00\\x00\\x00\\x00\\x00\\x00@Z\"=>\"\"}\r\n```"},"comment":{"url":"https://api.github.com/repos/ohler55/oj/issues/comments/381077221","html_url":"https://github.com/ohler55/oj/issues/468#issuecomment-381077221","issue_url":"https://api.github.com/repos/ohler55/oj/issues/468","id":381077221,"user":{"login":"rkotov93","id":640137,"avatar_url":"https://avatars2.githubusercontent.com/u/640137?v=4","gravatar_id":"","url":"https://api.github.com/users/rkotov93","html_url":"https://github.com/rkotov93","followers_url":"https://api.github.com/users/rkotov93/followers","following_url":"https://api.github.com/users/rkotov93/following{/other_user}","gists_url":"https://api.github.com/users/rkotov93/gists{/gist_id}","starred_url":"https://api.github.com/users/rkotov93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkotov93/subscriptions","organizations_url":"https://api.github.com/users/rkotov93/orgs","repos_url":"https://api.github.com/users/rkotov93/repos","events_url":"https://api.github.com/users/rkotov93/events{/privacy}","received_events_url":"https://api.github.com/users/rkotov93/received_events","type":"User","site_admin":false},"created_at":"2018-04-13T09:19:23Z","updated_at":"2018-04-13T09:19:23Z","author_association":"NONE","body":"Yay, works fine :+1:"}}
{"actor":{"display_login":"rkotov93"}}