Example usage for org.apache.poi.hsmf MAPIMessage set7BitEncoding

List of usage examples for org.apache.poi.hsmf MAPIMessage set7BitEncoding

Introduction

In this page you can find the example usage for org.apache.poi.hsmf MAPIMessage set7BitEncoding.

Prototype

public void set7BitEncoding(String charset) 

Source Link

Document

Many messages store their strings as unicode, which is nice and easy.

Usage

From source file:org.apache.tika.parser.microsoft.OutlookExtractor.java

License:Apache License

private boolean tryToSet7BitEncoding(MAPIMessage msg, String charsetName) {
    if (charsetName == null) {
        return false;
    }//from  ww  w.j  a v a  2  s.com

    if (charsetName.equalsIgnoreCase("utf-8")) {
        return false;
    }
    try {
        if (Charset.isSupported(charsetName)) {
            msg.set7BitEncoding(charsetName);
            return true;
        }
    } catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
        //swallow
    }
    return false;
}