It’s debatable whether the name Ernest, used punningly by Wilde in his most famous play The Importance of Being Earnest, was chosen as a late Victorian code word for “gay”.
For instance, the Wildean academic, John Stokes, suggests here this may be true “since the word ‘Earnest’ bears a euphonious relation to the [gender-variant] term Uranian”—presumably in the sound of its continental equivalents. 
On the other hand, the actor, Sir Donald Sinden, who both knew and consulted Lord Alfred Douglas and Sir John Gielgud on the point, once wrote to The Times to dispute the suggestion. 
However, whether the words Ernest and Earnest are homosexual or merely homophonic, one thing is clear.
The choice of names, and particularly the name Ernest, formed part of a gay literary subtext close to Wilde in the 1890s.