Fix some characterset issues between linux and bsd.