If a function is almost everywhere continuous then it is the limit of step functions almost everywhere. I want to prove that if $f: \mathbb{R} \rightarrow \mathbb{R}$ is continuous a.e. the there is a sequence of step functions $(\phi_n)$ such that $\displaystyle f=\lim_{n\rightarrow \infty }\phi_n$ a.e. 
What I thought is that $f$ is Riemann Integrable on any compact, then if I could find a step function $\phi_n$ a.e. within $1/n$ from $f$ on $[-n,n]$ I would be done taking $n \rightarrow \infty $ 
But I don't think Riemann Integrability is sufficient to get this condition, as the space of regulated functions is a subspace of the Riemann Integrable ones.... any suggestion?
EDIT :
Maybe considering $\mathbb{R} $ taking away $\cup _{i=1}^{\infty} I_n$ covering the null set in which $f$ is not continuous, so there is a step function approximating $f$ on this set, then I extend it to a step function on $\mathbb{R}$ by giving it any value on the union of the $I_i$.... 
EDIT2 ok I will try to expand on my previous edit.
Let $n \in \mathbb{N}$ Consider the covering for the set in which $f$ is not continuous made of the open intervals $(I_n)$ s.t. $\sum l(I_n) < 1/n$
Now $f$ is continuous on the compact $[-n,n] \setminus (\cup I_n)$ so choose the step function $ \theta _n$ to be s.t. $|\theta_n - f|<1/n$ on this compact.
Now consider $\phi_n$ defined on the all $[-n,n]$ to be equal to $1$ where $\theta_n$ is not defined.
Then $\phi_n$ is a step function and as $n \rightarrow \infty$ it converges to $f$ almost everywhere.
What do you think of this?
 A: Your intuition is correct: a formal proof is as follows.
Let $f$ be continuous on $\mathbb R\setminus E$ with $\mu(E)=0$ where $\mu$ denotes the Lebesgue measure over $\mathbb R$. $E$ is measurable, therefore (by definition) for every $n\in\mathbb N$ there exists an open set $E_n\supseteq E$ such that $\mu(E_n)<\frac 1n$. An open set in $\mathbb R$ is countable union of open intervals, so that for every $n\in\mathbb N$ the compact set $R_n\,\dot=\,[-n,n]\setminus E_n$ (on which $f$ is continuous) is countable union of intervals - where a set $\{x_0\}$ is considered as the closed interval $[x_0,x_0]$. Note that $R_n\nearrow\mathbb R\setminus E$ as $n\to\infty$.
Assuming (which is true) that every continuous function is uniformly approximable with step functions over compact sets let $\vartheta_n$ be a step function with ${\sf supp}\vartheta_n\subseteq[-n,n]$ and such that $\|\vartheta_n-f\chi_{R_n}\|_\infty<\frac1n$ where $\chi_{R_n}$ denotes the characteristic function of the set $R_n$. (Just for a matter of simplicity, so that there is no need to define another function $\varphi_n$, I chose $\vartheta_n$ to be equal to $0$ on $[-n,n]\setminus R_n=E_n$ instead of $1$ which would work as well). Note that $\vartheta_n$ is a step function over $\mathbb R$ as well (not only over $R_n$).
Then for every $x\in\mathbb R\setminus E~$ $\vartheta_n(x)\to f(x)$ as $n\to\infty$. In fact, since $R_n\nearrow\mathbb R\setminus E$, there exists a natural $\nu=\nu(x)$ such that $x\in R_n$ for every $n\geq\nu$, therefore by the property of $\vartheta_n$ you have that $|\vartheta_n(x)-f(x)|<\frac 1n$ for every $n\geq\nu$. This ensures that $\vartheta_n\to f$ pointwise in $\mathbb R\setminus E$, id est almost everywhere.
EDIT: I think that local Riemann-integrability over is sufficient though. If $f$ is locally Riemann-integrable, then for every $n$ there exists a partition $\mathcal P_n=(t_0,\ldots,t_{k_n})$ of $[-n,n]$ such that
$$
\left| s_n - \int_{-n}^nf(x)\,{\rm d}x \right| < \frac 1n
$$
where
$$
  s_n
=
  \sum_{j=1}^{k_n} (t_j-t_{j-1})m_j
\quad\text{and}\quad
  m_j
=
  \underset{x\in[t_{j-1},t_j]}{\sf ess\,inf} f(x)
$$
where the essential infimum is taken with respect to the Peano-Jordan measure. Therefore the function
$$
  \vartheta_n
=
  \sum_{j=1}^{k_n} m_j\chi_{(t_{j-1},t_j]}
$$
locally converges in the $L^1$-norm to $f$ as $n\to\infty$ (remember that a locally Riemann-integrable function is also locally Lebesgue integrable). There is an easily provable result that states that this implies that there exists a subsequence $\vartheta_{n_j}$ which converges to $f$ almost everywhere as $j\to \infty$.
