Chinese consumer inflation edged up in October for a second consecutive month, helped by higher food prices, though the rise was based on a comparison with particularly weak prices a year ago. China’s consumer-price index increased 2.1% last month from a year earlier compared with a 1.9% gain in September, the National Bureau of Statistics said Wednesday. The key measure of inflation matched a forecast by 14 economists surveyed by The Wall Street Journal. China’s producer-price index rose by a faster-than-expected 1.2% in October from a year earlier, compared with September’s 0.1% increase. Before September’s uptick, the gauge of factory prices had lingered in deflationary territory for more than four years.