Change of variables in Riemann–Stieltjes integral I want
\begin{equation}
\int_a^b f(g(x))dg=\int_{g(a)}^{g(b)} f(t)dt,\tag{$\heartsuit$}\label{heart}
\end{equation}
where $g$ is a continuous but not necessarily monotone (or bounded variation) function of $[a,b]$, both integrals are Riemann–Stieltjes (that is, $\int_a^b h(x)dg(x)$ is the limit of Riemann–Stieltjes sums $\sum_{i=0}^{n-1} h(c_i)(g(x_{i+1})-g(x_i))$ where $a=x_0<x_1<\dotsb<x_n=b$ is a partition of $[a,b]$, $c_i\in [x_i,x_{i+1}]$ for $i=0,\dotsc,n-1$, and $\max \lvert x_{i+1}-x_i\rvert$ goes to 0).
If both integrals in \eqref{heart} exist, does it follow that they are equal?
Note that without continuity of $g$ this is not necessarily so, even if $g$ is increasing: say, if $a=0$, $b=1$, $g(x)=\chi_{[1/2,1]}$, and $f(0)=f(1)=0$, then LHS is 0 but RHS may be non-zero. For increasing continuous $g$ this is less or more obvious. But we sometimes would like to have not monotone change of variables (cf. $\int_a^b f(x^2)x\,dx=\frac12 \int_{a^2}^{b^2} f(t)dt$ with $a<0<b$).
If not, what are additional conditions under which \eqref{heart} holds?
 A: Looks like the answer is yes, they are equal, and perhaps you do not really need to assume the existence of the integral in the right-hand side, that is, $\int_{g(a)}^{g(b)} f(t) dt$. This is proved in the context of Henstock–Kurzweil integrals as Theorem 6.1 in [1].
The key lemma is that if $g(a) = g(b)$, then $\int_a^b f(g(x)) dg(x) = 0$. This is applied to reduce the problem to the case when $g$ is monotone, which is rather well-known.
Reference:
[1] Michael Bensimhoun, Change of Variable Theorems for the KH Integral,  Real Analysis Exchange 35(1) (2009–2010): 167–194, DOI:10.14321/realanalexch.35.1.0167
A: Let me try to give a short argument that if LHS integral exists and equals $I=\int_{a}^b f(g(x))dg$ than $\int_{g(a)}^{g(b)} f(t)dt$ exists and equals $I$.
Without loss of generality $g(a)\leqslant g(b)$, and it suffices for any fixed $I_1>I$ to find a partition of $[g(a),g(b)]$ such that upper Darboux sum for $\int f$ is at most $I_1$ (then do the same for lower Darboux sum and use the description of Riemann integral via Darboux sums). For this, we find a partition $a=\xi_0<\xi_1<\ldots<\xi_n=b$ of $[a,b]$ such that any corresponding Riemann–Stieltjes sum of $\int_a^b f(g)dg$ is less than $I_1$. Denote $$p_i=\begin{cases}\sup_{g(\xi_i)\leqslant t\leqslant g(\xi_{i+1})} f(t),&\text{if}\,\, g(\xi_i)\leqslant g(\xi_{i+1})\\
\inf_{g(\xi_{i+1})\leqslant t\leqslant g(\xi_{i})} f(t),&\text{if}\,\, g(\xi_{i+1})\leqslant g(\xi_{i})\end{cases}.$$
Then, since $g$ is continuous, using intermediate value theorem we see that $f(g(x))$ takes the values arbitrarily close to $p_i$ when $x\in [\xi_i,\xi_{i+1}]$, and we get $$\kappa:=\sum_{i=0}^{n-1} (g(\xi_{i+1})-g(\xi_{i}))p_i\leqslant I_1.$$
Now denote $c_0\leqslant c_1\leqslant c_2\leqslant \cdots\leqslant c_n$ the numbers $g(\xi_0),\ldots,g(\xi_n)$ in increasing order, let $c_A=g(a)$, $c_B=g(b)$. Consider the partition $c_A\leqslant \ldots\leqslant c_B$ of $[g(a),g(b)]$. I claim that corresponding upper Darboux sum for $\int_{c_A}^{c_B}f(t)dt$ is at most $\kappa$, that is sufficient for our goal. For proving this we denote $\delta_i=c_{i+1}-c_i$, and we represent each expression $g(\xi_{i+1})-g(\xi_i)$ as $\pm$ sum of several consecutive $\delta$'s. Look at the expression for $\kappa$ as a linear combination of $\delta$'s (omitting $\delta$'s which are equal to 0.) If $i<A$ or $i\geqslant B$, $\delta_i$ comes equally many times with $+p_{\ldots}$ and with $-p_{\ldots}$ (to see this, put a surveillance camera at the midpoint of this $\delta_i$ segment, and look how a fly walking by the route $g(\xi_0)\to g(\xi_1)\to\cdots \to g(\xi_n)$ flies behind the camera to left and to right). Analogously, if $A\leqslant i<B$, $\delta_i$ comes one more time more with with $+p_{\ldots}$ than with $-p_{\ldots}$. Finally, when $\delta_i$ comes with $+p_j$, we have $p_j\geqslant \sup_{t\in [c_i,c_{i+1}]} f(t)$, while when $\delta_i$ comes with $-p_j$, we have $p_j\leqslant \sup_{t\in [c_i,c_{i+1}]} f(t)$ (and even $p_j\leqslant \inf_{t\in [c_i,c_{i+1}]} f(t)$). This all yields $$\kappa\geqslant \sum_{i=A}^{B-1}\delta_i\cdot \sup_{t\in [c_i,c_{i+1}]}f(t)$$
which is a corresponding Darboux sum for $\int_{g(a)}^{g(b)} f(t)dt$.
