add unicode test to SNL, modify is_valid to use encode/decode