Issue 1506: length argument wrong with unicode