added index, added encoding convertion