How has quark electric charge been directly measured? How has quark electric charge been directly measured when quarks are never directly observed in isolation (due to a phenomenon known as color confinement)?
 A: The history of the proposal of the quark model of hadrons is interesting.

The quark model was independently proposed by physicists Murray Gell-Mann and George Zweig in 1964. The proposal came shortly after Gell-Mann's 1961 formulation of a particle classification system known as the [Eightfold Way]—or, in more technical terms, SU(3) flavor symmetry. Physicist Yuval Ne'eman had independently developed a scheme similar to the Eightfold Way in the same year.
At the time of the quark theory's inception, the "particle zoo" included, amongst other particles, a multitude of hadrons. Gell-Mann and Zweig posited that they were not elementary particles, but were instead composed of combinations of quarks and antiquarks. Their model involved three flavors of quarks—up, down, and strange—to which they ascribed properties such as spin and electric charge. The initial reaction of the physics community to the proposal was mixed. There was particular contention about whether the quark was a physical entity or an abstraction used to explain concepts that were not properly understood at the time.

The story goes on, but it was the classification of the plethora of hadrons  into representations of an SU(3) symmetry  group  that simplified the particle zoo. Identifying the vectors entering SU(3)_flavor as "quarks" became acceptable because of the symmetry. The charges of the quarks are defined  from this symmetry, otherwise the "eightfold way" classification would not work.
In a sense then the measurement of the charges of the quarks comes from the various SU(3) representations of the composite hadrons:
 
----------meson octet -------------------------------baryon decuplet
--------charge is on diagonal--------
The reality of the  existence of quarks as particles (  not as convenient mathematical tools)  came by probing the protons with high energies and studying the interaction products, which could be identified as quarks and gluon jets of QCD, the strong interaction. See also Lubos' comment to your question.
A: The cross-section for 
$$ e^+ + e^- \to q + \bar{q} $$
goes by the square of the quark charge (times the number of colors). Now, the quarks can not be observed in isolation because they hadronize.
However the cross-section for
$$ e^+ + e^- \to \mu^+ + \mu^- $$
is identical except for going by the muon charge squared. 
So, a measurement of 
$$ R = \frac{\sigma_{e^+ + e^- \to \text{hadrons}}}{\sigma_{e^+ + e^- \to \mu + \mu^-}} $$
is a measurement of 
$$ \frac{\text{# of colors} \times \sum_\text{accessible flavors} q^2_\text{flavor}}{q^2_\mu} = \frac{\text{# of colors} \times \sum_\text{accessible flavors} q^2_\text{flavor}}{1} \quad .$$
The accessible flavors depend on the center of mass energy, so it is possible to observe the increases as the energy rises past successive quark masses (times 2).
This figure :

shows $R$ over a range of center-of-mass energy (Mandelstam variable $s$) that covers the range from only including the "light" quarks (up, down and strange) through including all the quarks through the bottom with enough range to show the long plateau about the bottom quark threshold. 
The results are consistent with three colors and the usual charge assignments (up-like quarks are +2/3 and down-like quarks are -1/3) from the baryon spectrum.
A: This is the biggest mess mankind have produced:
SU(3) simmetry can work also if you suppose the quarks charges upward from de center of the SU(3) simmetry: 1/3, 2/3, 1/2, and the electron's = -1/2.  The neutron, with electron's charge, will be 1, and the proton, without it, will be 1.5. The desbalance from Unity will account for its positivness. Being so the neutron, the confined neutral Unity and the proton, its excited form. That is it! 
