Go to previous topic
Go to next topic
Last Post 06 Oct 2016 10:17 PM by  Pengtsen R
Video Url for Unicode Titles
 1 Replies
Author Messages


New Member


Posts:18
New Member


--
16 Sep 2016 02:24 AM
    My video title is [معرفی مرسدس-AMG سی کلاس نسخه AMG کانورتیبل] unicode title and in url
    htpp://mysite.com/Player/VideoId/1/معرفی مرسدس-AMG سی کلاس نسخه AMG کانورتیبل
    but UVG show this
    http://mysite.com/Player/VideoId/1/-------

    I change for show unicode urls

    public static string ToUrlSlug(string value){

    //First to lower case
    value = value.ToLowerInvariant();

    //Remove all accents
    var bytes = Encoding.GetEncoding("Cyrillic").GetBytes(value);

    value = Encoding.ASCII.GetString(bytes);

    //Replace spaces
    value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled);

    //Remove invalid chars
    value = Regex.Replace(value, @"[^\w\s\p{Pd}]", "",RegexOptions.Compiled);

    //Trim dashes from end
    value = value.Trim('-', '_');

    //Replace double occurences of - or \_
    value = Regex.Replace(value, @"([-_]){2,}", "$1", RegexOptions.Compiled);

    return value ;
    }


    Basic Member


    Posts:198
    Basic Member


    --
    06 Oct 2016 10:17 PM
    UVG specially remove non-ascii characters from the URL for SEO purposes.


    ---