Skip to content
Advertisement

Python requests and LanguageTool encoding error

I am trying to post text data to a langaugetool server. My text includes trademark symbols and copyright symbols etc.

On my first attempt to just post the text like so:

JavaScript

I received an error from requests:

JavaScript

Following this post I updated my request as follows:

JavaScript

Now requests does not error but the langaugetool server complains that it cannot decode the query:

JavaScript

I’ve checked all the languagetool docs and cannot find anything about encodings. I don’t know at this stage whether the problem is requests, languagetool, or something else I’m doing wrong. Is it possible to post characters like a trademark symbol to languagetool and if so how?

Advertisement

Answer

Pass parameters as a dictionary. No need to manually encode anything:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement