fixed cockup in dealing with charactersets. closes #1513, #1514