package com.hubspot.jinjava.tree.output;

public class BlockPlaceholderOutputNode implements OutputNode {

  private final String blockName;
  private String output;

  public BlockPlaceholderOutputNode(String blockName) {
    this.blockName = blockName;
  }

  public String getBlockName() {
    return blockName;
  }

  public boolean isResolved() {
    return output != null;
  }

  public void resolve(String output) {
    this.output = output;
  }

  @Override
  public String getValue() {
    if (output == null) {
      throw new IllegalStateException("Block placeholder not resolved: " + blockName);
    }

    return output;
  }

  @Override
  public long getSize() {
    return output == null ? 0 : output.getBytes().length;
  }

  @Override
  public String toString() {
    return getValue();
  }

}

@@ -35,16 +35,91 @@
 utput;%0A%0A
+import java.nio.charset.Charset;%0A%0Aimport com.google.common.base.Charsets;%0A%0A
 public c
@@ -793,16 +793,54 @@
 etBytes(
+Charset.forName(Charsets.UTF_8.name())
 ).length

fix usage of detault encoding