title: How to convert unicode string to proper character using jQuery?
body: <p>Here I have the following function to convert the string into a slug to make SEO friendly URL.</p>
  
  <pre><code>stringToSlug: function (title) {
     return title.toLowerCase().trim()
         .replace(/\s+/g, '-')           // Replace spaces with -
         .replace(/&amp;/g, '-and-')         // Replace &amp; with 'and'
         .replace(/[^\w\-]+/g, '')       // Remove all non-word chars
         .replace(/\-\-+/g, '-')         // Replace multiple - with single -
      }
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var title1 = 'Maoist Centre adamant on PM or party chair’s post';
  function stringToSlug1 (title) {
    return title.toLowerCase().trim()
      .replace(/\s+/g, '-')           // Replace spaces with -
      .replace(/&amp;/g, '-and-')         // Replace &amp; with 'and'
      .replace(/[^\w\-]+/g, '')       // Remove all non-word chars
      .replace(/\-\-+/g, '-')         // Replace multiple - with single -
   }
  console.log(stringToSlug1(title1));
  
  var title2 = 'घर-घरमा ग्यास पाइपः कार्यान्वयनको जिम्मा ओलीकै काँधमा !';
  
  function stringToSlug2 (title) {
    return title.toLowerCase().trim()
      .replace(/\s+/g, '-')           // Replace spaces with -
      .replace(/&amp;/g, '-and-')         // Replace &amp; with 'and'
      .replace(/[^\w\-]+/g, '')       // Remove all non-word chars
      .replace(/\-\-+/g, '-')         // Replace multiple - with single -
   }
  console.log(stringToSlug2(title2));</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here I have implemented the above mentioned function with two different languages. Function <code>stringToSlug1</code> with English and <code>stringToSlug2</code> with Nepali language. With English text the function is working fine but when the text is in other language above mentioned functions return only -. <strong>Result I want to achieve from function stringToSlug2 is घर-घरमा-ग्यास-पाइप-कार्यान्वयनको-जिम्मा-ओलीकै-काँधमा</strong></p>