China is spending billions of dollars to improve its international image, yet it is also ramping up anti-foreigner rhetoric.