elharo opened a new issue, #125:
URL: https://github.com/apache/maven-acr-plugin/issues/125

   ### New feature, improvement proposal
   
   ```
    static String detectEncoding(File file) thjrows IOException {
           Tika tika = new Tika();
               // Tika's detect method checks for explicit declarations (like 
XML) 
               // and BOMs, then falls back to robust statistical analysis.
               String detectedEncoding = tika.detect(file.toPath());
               
               // Tika's detect() returns a MIME type like "text/plain; 
charset=UTF-8" or just "UTF-8".
               if (detectedEncoding.contains("charset=")) {
                   return 
detectedEncoding.substring(detectedEncoding.indexOf("charset=") + 8);
               }
               return detectedEncoding;
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to