(Cpp) split strings which are too long (closes #2744)

@hughsando: please review for 3.1.1 as this is a regression