I guess firebase tag is like url rules since it is a database. You can use this method.
Encode to store tag and decode them to get the original data. As you can see #
$
is replaced with %23%
and %24
etc.,. If you want to get back them in original form. Use the Decode and they will become normal again.
Percentage is a part of urls and it is supported in firebase too