Treat replacement water with neutralizers for these chemicals and allow the water to age for a day or so. This allows the products to work, compressed gases to evaporate, and the water to reach the same temperature as the tank water. Chemistry and pH Goldfish thrive at pH levels with in the range of 6.0 - 8.0. There are products available to test for pH, but pH is usually not the problem in cases of poor water quality. Of far greater concern are ammonia, and nitrite levels.
Ammonia is produced in large amounts by goldfish themselves.
There are products available that control the level of ammonia in the water, however these are usually not reliable. They work well in the short-term by immediately decreasing ammonia levels, but they usually fail to keep ammonia concentration at a consistently low level over a longer period of time. The most effective way to keep ammonia levels low is by ensuring a healthy mixed bacterial population in the tank, again commercial bacterial inoculants are available to aid in this process. Another group of bacteria convert the nitrites to nitrates. Nitrates are almost harmless and easily controlled by regular water changes.