Closed keineahnung2345 closed 1 year ago
eval
is not acceptable. What is the error? Cannot be changed the REGEXP to fix the error?
The remaining part of the error message is just the json file. Maybe this error happens because my file is in Chinese.
Post the file, I will try it.
I have tried to index a file with some Chinese words and it worked fine:
Thank you. I've also found that it works for my other Chinese files. But that file is somehow credential, I'll check what's wrong myself.
After applying the PR above, there's still another problem for my Chinese docx file, attributes[:filename]
should be 客戶.docx
, but it will be shown as xE5xAExA2xE6x88xB6.docx
. It seems JSON.parse
eats the backslashes.
Also attributes[:url]
is affected so the links shown are invalid.
I believe, that I've fixed most of the reported problems:
Yes, the instance_eval
works like a charm.
In devel branch, I have to revert the change in https://github.com/xelkano/redmine_xapian/commit/15e120845b0f3865b636cd3bdb17bf8ee4dd97d5 a.k.a: change
attributes = JSON.parse(value.gsub(/:([a-zA-z]+)/, '"\\1"').gsub('=>', ': ')).symbolize_keys
toattributes = eval value
to get rid of JSON::ParserError.