public static Charset getTargetCharset ( Document doc ) { String defaultEncoding = System . getProperty ( Citrus . CITRUS_FILE_ENCODING_PROPERTY , System . getenv ( Citrus . CITRUS_FILE_ENCODING_ENV ) ) ; if ( StringUtils . hasText ( defaultEncoding ) ) { return Charset . forName ( defaultEncoding ) ; } if ( doc . getInputEncoding ( ) != null ) { return Charset . forName ( doc . getInputEncoding ( ) ) ; } // return as encoding the default UTF-8 return Charset . forName ( "UTF-8" ) ; }
Try to find encoding for document node . Also supports Citrus default encoding set as System property .