I think I'm right in saying that certainly in the UK, going about dressed isn't a crime, unless you do so to purposefully deceive for criminal purposes. Entering into a sexual act by deception would be considered such. "I thought he knew I was a man" wouldn't be a defence in court.

Not that long ago here in the UK a woman was jailed for dressing as a man for the purposes of having sexual relations with females.