Api (http server) - new line not recognized

I’m trying to make use of the built-in http server. For making requests I use curl (the one built in php). The text is encoded with urlencode() before “posting” (content-type: application/x-www-form-urlencoded).
The problem is that LanguageTool doesn’t seem to recognize new lines (CRLF) and treat them as spaces, which obviously produces errors (typographical).

What exactly is the text you’re checking? Could you also post the PHP snippet that makes the call?

I have checked with GUI to compare results and it turns out that the newline isn’t considered a sentence break. Only double newline (CRLFCRLF) does that. Strange, but I suppose it has something to do with language rules.

Here is the snippet:
$text=“Pokonaj ból odpowiedzialnie\r\nAktualnie masz wyłączony JavaScript.”;
$ch=curl_init(‘http://localhost:8081/’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘language=pl&text=’.urlencode($text));
$r=curl_exec($ch);
curl_close($ch);
var_dump(htmlentities($r));

If you change $text to “Pokonaj ból odpowiedzialnie\r\n\r\nAktualnie masz wyłączony JavaScript.” it generates completely different error (the right one!).

The problem is solved for me. :wink:

This is expected - also see the “-b” option at Command-Line Options - LanguageTool Wiki. However, for the HTTP API there’s no setting to change the behavior, so you need to modify your text before you send it.