We agree that the pair has integral charge (zero in fact), right?
So now we need a model of hadronization (the process in which the quarks generate hadrons). You've probably got some picture of the quarks flying apart and then separately undergoing a process to produce a bunch of stuff.
Unfortunately that picture isn't really correct.
The principle of "confinement" is that colored objects (i.e. quarks) can not exist in isolation, so you should think of the pair of quarks being connected by a region of high strong-nuclear force potential (often called a "flux tube"). The nature of the strong force is that it get stronger as the separation between colored objects increases; so as the quarks pull further and further apart the the total energy in the flux tube grows at the pair separates until production occurs.
So you go from
$q$ -- $\bar{q}$
to
$q$ ----------- $\bar{q}$
to
$q$ ---- $x$ $\bar{x}$ ------- $\bar{q}$
to
$q$ ----- $x$ -- $\bar{x}$ ---- $\bar{q}$
and these may keep on separating from there (energy permitting, of course).
Depending on the nature of $x$ and $\bar{x}$ this could be the end of it, you get two mesons and you're done. But that is unlikely: more often one or both pairs are not color neutral or not bound so they pull apart some more and the new flux tubes also break.
For concreteness pretend that
- $q$ is red-up
- $x$ is antired-antidown
- the kinematics are such that $q$ and $x$ can end up bound, but $\bar{x}$ and $\bar{q}$ won't
this meas the next step might loop like
$u\bar{d}$ ------- $d$ ------- $\bar{y}$ -- $y$ ----- $\bar{u}$
and when the first pair binds
$\pi^+$ ------- $d$ ------- $\bar{y}$ -- $y$ ----- $\bar{u}$
But since we started neutral and each breaking produces a particle--anti-particle (which is neutral in total) the total will end up neutral. And it is confinement that insures that each particle is either a baryon or a meson (because those are the only color neutral bound states known (people are still hoping to see more complex states)).
So the picture that you should have is of extra pairs being formed in the middle until we run out of energy or everything has combined by lucky chance.