简体   繁体   中英

How to make Unrecognized character escape '.' (code 46) to be Recognized - com.fasterxml.jackson.core.JsonParseException

I see this issue in docker-compose logs from magento2 container. Yeah, looking for the issue in some Magento2 plugin is nice idea and way to go, but for now it is not clear what is the reason of issue. There is an assumption that the problem comes from this string " Pris per fp. . " and few similar strings in product description.

It would be great if some ElasticSearch setting or even some patching could teach Jackson to ignore "." sequence for now, while it is not clear how to force Magento2 to reproduce the issue.

Currently I can reproduce the issue without Magento2 installed and hope to find a place where someone describes the way to work it out.

# Start an elasticsearch instance
docker run \
    --env 'node.name=mage-single-node' \
    --env 'cluster.name=mage-single-node' \
    --env 'discovery.type=single-node' \
-d --name=demo-es -p9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:6.8.17;

curl -XGET "http://localhost:9200/_search?" \
-H"Content-Type: application/json" -d'
{
  "query": {
    "query_string": {
      "query": "\."
    }
  }
}'

JSON only allows certain characters to be preceded by a \\ , and . isn't one of them. You can't change the JSON specification , and you're not going to persuade the authors of your JSON parser to accept invalid input, so you have to change your data to conform with the spec. That's what standards are for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM