import array


def strToByteArry(sStr):
    """Encodes the string as a little endian byte (B) array including the terminator."""
    abArray = array.array('B');
    sUtf8 = sStr.encode('utf_8');
    for ch in sUtf8:
        abArray.append(ord(ch));
    abArray.append(0);
    return abArray;