title: Get plain text from Wikipedia API by sections
body: <p>I'm trying to get plain(without html/css/special characters/ characters like \n/links/images) text of section using wikipedia api.
  I trying to do that with this code</p>
  
  <pre class="lang-py prettyprint-override"><code>import requests
  
  API_URL = 'http://en.wikipedia.org/w/api.php'
  
  def get_section(page, section):
      search_params = {
          'action': 'parse',
          'prop': 'text',
          'pageid': page,
          'section': section,
          'format': 'json'
      }
  
      response = requests.get(API_URL, params=search_params)
  
      return response.json()
  
  text = get_section(23862, 2)
  print(text['parse']['text']['*']).strip()
  
  </code></pre>
  
  <p>It returns this error</p>
  
  <pre><code>UnicodeEncodeError: 'charmap' codec can't encode character '\u2014' in position 5722: character maps to &lt;undefined&gt;
  </code></pre>
  
  <p>I need to get article sections like article intro using <code>exintro</code> parameter</p>
  
  <pre><code>https://en.wikipedia.org/w/api.php?action=query&amp;prop=extracts&amp;exintro&amp;explaintext&amp;pageids=23862
  </code></pre>
  
  <p>It returns plain text. Exactly what I need</p>