string ConvertOctalsInString(string inputString)
var regex = new Regex(@"\\\d{3}");
var matches = regex.Matches(inputString);
var bytes = new List<byte>();
foreach (var match in matches.OfType<Match>())
if (lastTail != match.Index)
var before = inputString.Substring(lastTail, match.Index - lastTail);
bytes.AddRange(Encoding.UTF8.GetBytes(before));
var octal = inputString.Substring(match.Index + 1, match.Length - 1);
bytes.Add(Convert.ToByte(octal, 8));
lastTail = match.Index + match.Length;
var lastMatch = matches[matches.Count - 1];
var remaining = inputString.Substring(lastMatch.Index + lastMatch.Length);
bytes.AddRange(Encoding.UTF8.GetBytes(remaining));
return Encoding.UTF8.GetString(bytes.ToArray());