core/play/src/main/java/play/http/HttpEntity.java
public static final HttpEntity fromContent(Content content, String charset) {
    String body;
    if (content instanceof Xml) {
      // See https://github.com/playframework/playframework/issues/2770
      body = content.body().trim();
    } else {
      body = content.body();
    }
    return new Strict(
        ByteString.fromString(body, charset),
        Optional.of(content.contentType() + "; charset=" + charset));
  }
public static final HttpEntity fromContent(Content content, String charset) {
    String body;
    if (content instanceof Xml) {
      // See https://github.com/playframework/playframework/issues/2770
      body = content.body().trim();
    } else {
      body = content.body();
    }
    return new Strict(
        ByteString.fromString(body, charset),
        Optional.of(content.contentType() + "; charset=" + charset));
  }
Create an entity from the given content.

@param content The content.
@param charset The charset.
@return the HTTP entity.