It is not: for example, the piece-wise constant function f: [0,1] -> [0,1] which starts at f(0) = 0, stays constant until suddenly f(1/2) = 1, until f(3/4) = 0, until f(7/8) = 1, etc. is Riemann integrable.
"Continuous almost everywhere" means that the set of its discontinuities has Lebesgue measure 0. Many infinite sets have Lebesgue measure 0, including all countable sets.
"iff it is bounded and has countable discontinuities"?
Or, are there some uncountable sets which also have Lebesgue measure 0?
The indicator function of the Cantor set is Riemann integrable. Like you said, though, the Dirichlet function (which is the indicator function of the rationals) is not Riemann integrable.
The reason is because the Dirchlet function is discontinuous everywhere on [0,1], so the set of discontinuities has measure 1. The Cantor function is discontinuous only on the Cantor set.
Likewise, the indicator function of a "fat Cantor set" (a way of constructing a Cantor-like set w/ positive measure) is not Riemann integrable: https://en.wikipedia.org/wiki/Smith%E2%80%93Volterra%E2%80%9...
Here's an example of a Riemann integrable function w/ infinitely many discontinuities: https://en.wikipedia.org/wiki/Thomae%27s_function
Anyone interested in this should check out the Prologue to Lebesgue's 1901 paper: http://scratchpost.dreamhosters.com/math/Lebesgue_Integral.p...
It gives several reasons why we "knew" the Riemann integral wasn't capturing the full notion of integral / antiderivative
- except finitely many, or
- except a set of measure zero.