title: Can't able to find a keyword in a File
body: <p>When I try to Find a Keyword from the GetLine() Function It only Returns a Empty String. But when I try to print the Line with std::cout, it prints everything, so i debugged the solution I found that the String is empty but std::cout somehow manages to print the lines in file.</p>
  <pre><code> std::ifstream file(fileToSearch);
          std::string line;
  
  
          cout &lt;&lt; endl &lt;&lt; keyWords[i];
          while (std::getline(file, line)) {
             
              cout &lt;&lt; endl &lt;&lt; keyWords[i]&lt;&lt;&quot; &quot;;
              cout &lt;&lt; line;
              if (auto pos = line.find(keyWords[i]) != std::string::npos) {
                  //   std::stringstream iss(line.substr(pos + keyWords[i].size()));
                  cout &lt;&lt; endl &lt;&lt; &quot;found again in String Table&quot; &lt;&lt; endl;
                  //iss &gt;&gt; j;
                  break;
              }
  
          }
  </code></pre>
  <p>This is the data in the File</p>
  <pre><code>%Checking Windows(R) Installer VersionConfiguring Windows InstallerConfiguring %s½Setup has completed configuring the Windows Installer on your system. The system needs to be restarted in order to continue with the installation. Please click Restart to reboot the system.%s  
  </code></pre>
  <p>When I checked the Encoding of the file in Notepad++. I found that the file is not encoded at all , but when I changed the file to UTF-8 I can get the Value and Search It Successfully. Is there anyway to do this by code rather than changing it Manually??</p>
  <p><a href="https://i.stack.imgur.com/U2dnX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U2dnX.png" alt="Look at the encoding here" /></a></p>