title: Telegram bot Can't find end of the entity starting at (truncated...)
body: <p>I've made a telegram bot which logs critical errors in our telegram chat.
  This bot has been used in another symfony application (4.4), and worked fine.</p>
  
  <p>But now I'm trying to use it in a Symfony 3.4 project and upon generating an error, telegram responds with:</p>
  
  <pre><code>resulted in a `400 Bad Request` response:
  {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at  (truncated...)
  </code></pre>
  
  <p>However, changing the <code>parse_mode</code> from <code>Markdown</code> to <code>HTML</code> fixes the issue, but I'm trying to wrap my head around it why this could be.</p>
  
  <p>This is the string I'm trying to send:</p>
  
  <pre><code>$message = "$user just had an error at: $path\n`$error`\n$file:$line";
  </code></pre>
  
  <p>This is the function which sends the request:</p>
  
  <pre class="lang-php prettyprint-override"><code>/**
   * @param $method
   * @param $headers
   * @param $body
   * @return mixed|ResponseInterface
   * @throws GuzzleException
   */
  public function APIMethod($method, $headers, $body)
  {
      $client = new Client();
      $uri = 'https://api.telegram.org/bot' . $this-&gt;telegramToken . '/' . $method;
  
      return $client-&gt;request('POST', $uri, [
          'headers' =&gt; $headers,
          'form_params' =&gt; $body,
      ]);
  }
  
  /**
   * @param $telegramId
   * @param $text
   * @return mixed|ResponseInterface
   * @throws GuzzleException
   */
  public function sendNotification($telegramId, $text)
  {
      try {
          return $this-&gt;APImethod('sendMessage', [
              'Content-Type' =&gt; 'application/x-www-form-urlencoded',
              'Accept' =&gt; 'application/json',
          ], [
              'chat_id' =&gt; $telegramId,
              'parse_mode' =&gt; 'Markdown',
              'text' =&gt; $text,
              'disable_web_page_preview' =&gt; true,
          ]);
      } catch (Exception $exception) {
          return $exception-&gt;getMessage();
      }
  }
  </code></pre>
  
  <p>Thanks in advance</p>