public static string GetString(byte[] bytes, int offset, int length) { try { return Encoding.UTF8.GetString(bytes, offset, length); } catch (IOException e) { throw new Exception("UTF-8 to string conversion failed: " + e.Message); } }