Fix for #2519: CGridView and CListView problem with history enabled and special characters

Fixes #2519: CGridView and CListView problem with history enabled and special characters