public static string GetSubString(string title, int length)
    {
        int totalLength = 0;
        int currentIndex = 0;
        while (totalLength < length && currentIndex < title.Length)
        {
            if (title[currentIndex] < 0 || title[currentIndex] > 255)
                totalLength += 2;
            else
                totalLength++;
            currentIndex++;
        }
        if (currentIndex < title.Length)
            return title.Substring(0, currentIndex) + "...";
        else
            return title.ToString();
    }