for Java6, emulate subset of IETF BCP 47, fixed #474