Search code examples
httpunicodeencodingelasticsearchcyrillic

HTTPie/cURL don't display cyrillic characters on Windows


I hope one day I won't feel so much despair when facing an encoding problem.

I'm trying to call ElasticSearch HTTP API. PowerShell Invoke-WebRequest has no problems with cyrillic chars:

{
  "_index": "gofra",
  "_type": "orgs",
  "_id": "7104018679",
  "_score": 1.0,
  "_source": {
    "inn": "7104018679",
    "name": "МОУДОД \"ДШИ № 4\" Г. ТУЛЫ",
    "nameSuggest": {
      "input": [
        "ДШИ № 4",
        "МОУДОД ДШИ № 4",
        "МОУДОД ДШИ № 4 Г. ТУЛЫ"
      ]
    }
  }
}

But both cURL

{
  "_index": "gofra",
  "_type": "orgs",
  "_id": "7104018679",
  "_score": 1.0,
  "_source": {
    "inn": "7104018679",
    "name": "МОУДОД \"ДШИ № 4\" Г. ТУЛЫ",
    "nameSuggest": {
      "input": [
        "ДШИ № 4",
        "МОУДОД ДШИ № 4",
        "МОУДОД ДШИ № 4 Г. ТУЛЫ"
      ]
    }
  }
}

and HTTPie

{
  "innSuggest": {
    "input": [
      "7104018679"
    ],
    "payload": {
      "inn": "7104018679",
      "name": "?????? \"??? ? 4\" ?. ????"
    }
  },
  "name": "?????? \"??? ? 4\" ?. ????",
  "nameSuggest": {
    "input": [
      "??? ? 4",
      "?????? ??? ? 4",
      "?????? ??? ? 4 ?. ????"
    ]
  }
}

..fails, in different ways. What am I doing wrong? I'm particularly interested in using HTTPie.


Solution

  • It turned out I had my system locale set to English. I set it to Russian and the party started immediately.