I was working with an exercise of general topology and I had a question: are there an homeomorphism $f:\mathbb{R}\to(0,1)$ such that $f(x)\in\mathbb{Q}$ if and only if $x\in\mathbb{Q}$?, i.e., the homeomorphism maps the rationals to rationals and therefore the irrationals to irrationals.
My intuition says that the answer is yes but I can't find an example. The closer example was $g:\mathbb{R}\to(0,1)$ defined by $g(x)=\dfrac{1}{1+2^{-x}}$. But I think that doesn't works.