public static byte[] toBytes(String str) {
        Charset charset = Charset.forName("utf-8");

        ByteBuffer b = charset.encode(str);
        byte[] result = new byte[b.remaining()];
        b.get(result);
        return result;
    }
Normalizes a config definition line. Each string is normalized according to the
rules of config and definition files before they are used:
<ul>
<li>Remove trailing space.<li>
<li>Remove trailing comments, and spaces before trailing comments.</li>
<li>Remove empty lines</li>
<li>Keep comment lines</li>
</ul>
The supplied list is changed in-place

@param line a config definition line
@return a normalized config definition line
configgen/src/main/java/com/yahoo/config/codegen/NormalizedDefinition.java