  Standard candles can probe the evolution of dark energy in a large redshift
range. But the cosmic opacity can degrade the quality of standard candles. In
this paper, we use the latest observations, including type Ia supernovae (SNe
Ia) from JLA sample and Hubble parameters, to probe the opacity of the
universe. In order to avoid the cosmological dependence of SNe Ia luminosity
distances, a joint fitting of the SNe Ia light-curve parameters, cosmological
parameters and opacity is used. In order to explore the cosmic opacity at high
redshifts, the latest gamma-ray bursts (GRBs) are used. At high redshifts,
cosmic reionization process is considered. We find that the sample supports an
almost transparent universe for flat $\Lambda$CDM and XCDM models. Meanwhile,
free electrons deplete photons from standard candles through the (inverse)
Compton scattering, known as an important component of opacity. This Compton
dimming may paly an important role in future supernova surveys. From analysis,
we find that about a few percent cosmic opacity is caused by Compton dimming in
the two models, which can be correctable.
