Looking for the old forum?

For topics posted before June 2015, please click here to visit the old support forum. Post your questions in this forum if you have any questions.

Support Forums
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 06 Oct 2016 10:17 PM by  Pengtsen R
Video Url for Unicode Titles
 1 Replies
Sort:
You are not authorized to post a reply.
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:180
    Basic Member


    --
    06 Oct 2016 10:17 PM
    UVG specially remove non-ascii characters from the URL for SEO purposes.
    You are not authorized to post a reply.


    Copyright © 2005-2013 BizModules Contact us