Encode strings using .Net methods