Square AC to Sinusoidal AC
Several possbilities:

No, "normal" UPSs don't necessarily produce square waves.  Some, particularly old ones, do.  There are three common types: square, modified sine, and sine.  Square wave should be obvious.  Modified sine is trying to get closer to a sine wave while still just switching.  In this case instead of switching between + and - power, it also switches to 0.  The resulting waveform is more sine-like, which is another way of saying it has lower harmonic content.  Then of course the true sine wave inverters put out real sine waves with low harmonic content close to what the power line is.

If square wave power is such a problem, get a UPS that puts out a sine or possibly modified sine.  The premium for sine is much lower than it used to be.

Are you sure your 12 V adapter "can't bear" a square wave?  Most of them would be fine with that.  Just about any universal power input switcher should be fine with a square wave input.  If you really have a power supply that doesn't like square wave in, then get one that does.  The newer supply will probably be lighter and more efficient than the old klunker anyway.



Trying to somehow convert a square wave to a sine wave is not a good idea when this is intended for significant power.  If it were a signal instead of power, it would be easy enough to low pass filter it to reduce the harmonics, then amplify it back up to the right level.  That doesn't work for power because this process has a lot of power loss and you can't amplify the result.  You could try a inductor in series followed by a capacitor accross the signal, but the inductor will be big and expensive to handle significant power and do meaningful filtering.  You didn't say what your power level is, but replacing the old klunker UPS or getting a modern 12 V power supply will probably be cheaper than a very large inductor.  And, with the indutor/capacitor filter, the voltage and harmonic content will be somewhat load dependent.