public class CharsetUtils extends Object
| Constructor and Description |
|---|
CharsetUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getEncoding(org.mule.api.MuleMessage message,
byte[] bytes,
org.slf4j.Logger logger)
Tries to figure out the encoding of the request in the following order
- checks if the content-type header includes the charset
- detects the payload encoding using BOM, or tries to auto-detect it
- return the mule message encoding
|
static String |
getHeaderCharset(org.mule.api.MuleMessage message,
org.slf4j.Logger logger)
Returns the charset specified by the content-type header or null if not specified
|
static String |
getXmlEncoding(org.mule.api.MuleEvent muleEvent,
byte[] payload,
Document document,
org.slf4j.Logger logger)
Tries to figure out the encoding of an xml request in the following order
- checks if the document has a content-type declaration
- detects the payload encoding using BOM, or tries to auto-detect it
- return the mule message encoding
|
static byte[] |
trimBom(byte[] content)
Removes BOM from byte array if present
|
public static String getEncoding(org.mule.api.MuleMessage message, byte[] bytes, org.slf4j.Logger logger)
message - mule messagebytes - payload byte arraylogger - where to logpublic static String getXmlEncoding(org.mule.api.MuleEvent muleEvent, byte[] payload, Document document, org.slf4j.Logger logger)
muleEvent - mule eventpayload - xml payload as byte arraydocument - xml parsed documentlogger - where to logpublic static String getHeaderCharset(org.mule.api.MuleMessage message, org.slf4j.Logger logger)
message - mule messagepublic static byte[] trimBom(byte[] content)
content - byte arrayCopyright © 2021. All rights reserved.