My iPhone 5 started doing this a few days ago.
First time it stopped charging at 95% and today at 85% with the message of unsupported accessory. Original cable but plugged into a hub. In both cases, as I unplugged the cable from the hub and plugged into computer directly the phone beeped and continued charging.
Btw, it is an iPhone 5 under iOS 6. The iPhone 5s with iOS 7 charges normally on the same cable attached to the same usb hub.