How to encode a emoji string to correct permalink?

I make a testing.

  1. Set filename.
    .e.g :grinning:

  2. Open this page and got url


    The path is

  3. Call urlize.

    {{ $str := "πŸ˜€ home" }}
    {{ $str | urlize }} // home

Obviously missing a symbol β€œ-”. So, how can I get same strings?

Let’s take a step back:

  • why would you want a smiley being part of a file name?
  • why not just put the smiley in the title and use a file name that could have been used and viewed in browsers 10 years ago?

URLIZE creates a string that removed all the special characters (which smileys are part of) from the url.

Thanks for reply.
For first question: emoji just for fun.
Second: actually there no titles all of my articles.Filename as their titles.

I think you will have to go with frontmatter on this. Title with the smiley and filename with something nice with characters, dashes, dots and digits.