Make strings be counted properly, fixes #4033

This fixes issue #4033, and will count characters properly, including differing new line characters that differ in length on different platforms, and unicode characters.