added html char replacement loop