Character generators for unitary and symplectic groups