Let $X$ be a Hausdorff space such that the irrationals $\mathbb P$ (in their usual topology) form a dense subspace of $X$.


Let $C$ be the Cantor set. The set of "non-endpoints" of $C$ is homeomorphic to $\mathbb P$.


**Question.** If $f:C\to X$ is a continuous surjection such that $f\restriction \mathbb P$ is the identity map, then is $X$ necessarily disconnected?


NOTE: I suppose we could ask the same question with $\mathbb P$ replaced with the rationals $\mathbb Q$ (identifying the endpoints of $C$ with $\mathbb Q$). 



Cantor set onto connected set?
To rephrase and explicitate YCor's example in the comments, consider the [devil's staircase function](https://en.wikipedia.org/wiki/Cantor_function): it maps the non-endpoints of the standard Cantor set $C$ to the non-dyadic reals in $[0,1]$. Now compose (on the left) with the inverse of the [question mark function](https://en.wikipedia.org/wiki/Minkowski%27s_question-mark_function), which is a self-homeomorphism of $[0,1]$ restricting to an increasing bijection between the dyadics to the irrationals. The composition $[0,1]\to[0,1]$ is continuous, nondecreasing, its restriction to $C$ is a surjection $C\to[0,1]$ mapping bijectively the set of non-endpoints of $C$ to the set of irrationals in $[0,1]$.


