safer encoding of values