ExtStringBuilder sb = new ExtStringBuilder(template);
sb.replaceAll("%gatewayId%", msg.getGatewayId());
sb.replaceAll("%encoding%", (msg.getEncoding() == MessageEncodings.ENC7BIT ? "7-bit" : (msg.getEncoding() == MessageEncodings.ENC8BIT ? "8-bit" : "UCS2 (Unicode)")));
sb.replaceAll("%date%", msg.getDate().toString());
sb.replaceAll("%text%", msg.getText());
sb.replaceAll("%pduUserData%", msg.getPduUserData());
sb.replaceAll("%originator%", msg.getOriginator());
sb.replaceAll("%memIndex%", msg.getMemIndex());
sb.replaceAll("%mpMemIndex%", msg.getMpMemIndex());
return sb.toString();
}