title: Encoding does not switch when trying to read json file
body: <p>I have a json file <code>file.json</code> encoded KOI8-R.</p>
  <p>Boost Json only works in UTF-8 encoding, so I'm converting the file from KOI8-R to UTF-8:</p>
  <pre><code>boost::property_tree::ptree tree;
  
  std::locale loc = boost::locale::generator().generate(ru_RU.UTF-8);
  std::ifstream ifs(&quot;file.json&quot;, std::ios::binary);
  ifs.imbue(loc)
  
  boost::property_tree::read_json(ifs, tree);
  </code></pre>
  <p>However, the file cannot be read .. What am I doing wrong?</p>
  <p><strong>UPDATE:</strong></p>
  <p>I made up a  JSON file &quot;test.txt&quot;:</p>
  <pre><code>{
      &quot;соплодие&quot;: &quot;лысеющий&quot;,
      &quot;обсчитавший&quot;: &quot;перегнавший&quot;,
      &quot;кариозный&quot;: &quot;отдёргивающийся&quot;,
      &quot;суверенен&quot;: &quot;носившийся&quot;,
      &quot;рецидивизм&quot;: &quot;поляризуются&quot;
  }
  </code></pre>
  <p>And saved it in koi8-r.</p>
  <p>I have a code:</p>
  <pre><code>#include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/json_parser.hpp&gt;
  
  int main() {
      boost::property_tree::ptree pt;
      boost::property_tree::read_json(&quot;test.txt&quot;, pt);
  }
  </code></pre>
  <p>Compiled, ran and got the following error:</p>
  <pre><code>terminate called after throwing an instance of 'boost::wrapexcept&lt;boost::property_tree::json_parser::json_parser_error&gt;'
    what():  test.txt(2): invalid code sequence
  Aborted (core dumped)
  </code></pre>
  <p>Then I use boost locale:</p>
  <pre><code>#include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/json_parser.hpp&gt;
  
  #include &lt;boost/locale/generator.hpp&gt;
  #include &lt;boost/locale/encoding.hpp&gt;
  
  
  int main() {
      std::locale loc = boost::locale::generator().generate(&quot;ru_RU.utf8&quot;);
      std::ifstream ifs(&quot;test.txt&quot;, std::ios::binary);
      ifs.imbue(loc);
      
      boost::property_tree::ptree pt;
      boost::property_tree::read_json(ifs, pt);
  }
  </code></pre>
  <p>Compiled (<code>g++ main.cpp -lboost_locale</code>), ran and got the following error:</p>
  <pre><code>terminate called after throwing an instance of 'boost::wrapexcept&lt;boost::property_tree::json_parser::json_parser_error&gt;'
    what():  &lt;unspecified file&gt;(2): invalid code sequence
  Aborted (core dumped)
  </code></pre>