How to convert a string to URL encoding?

Case c/c++ to c%2fc++

mypost.md

---
tags:
 - c/c++
---

It will be rendered /tags/c/c++.
There are no mistakes at present, but it seems dangerous.
I hope I can render /tags/c%2fc++,This is safer.

I wonder what Hugo does so that it does not lead to issues. Does Hugo really create a folder c, then a folder c++ inside?

Apart from that you can use the function safeURL to encode everything that might be misunderstood in a URL. I am not sure though how it will handle the ++ part of your tag.

You should know by the way that you can create a folder /content/tags containing one folder per tag (on a need to use base, not a mus) that can contain an _index.md that can define a slug, title and other stuff like this:

---
title: C/C++
slug: c%2fc++
---

You might have to try around with that, maybe using c-c++ as actual tag you add to the content files, then using the title in the tags _index.md file. I have a template that uses either the title from the frontmatter or the capitalized tag.

Hope that helps somehow, at least to start some thoughts.