Пробовал вот этот код:
string content = project.Variables["cap4a"].Value;
Encoding utf8 = Encoding.GetEncoding("UTF-8");
Encoding win1251 = Encoding.GetEncoding("Windows-1251");
byte[] win1251Bytes = utf8.GetBytes(content);
byte[] utf8Bytes = Encoding.Convert(win1251, utf8, win1251Bytes);
return...