puppetlabs/razor-server — pull request #149 by daniel-pittman (2014-02-06 00:33:00+00:00)
Title: Make repository code Unicode aware

This updates the `filesystem_safe_name` code for repositories to handle UTF-8
correctly; the previous version would simply fail if non-ASCII characters were
present, thankfully making compatibility trivial.

The new code now handles two additional cases that the first version did not:
* Unicode characters (UTF-8) now work correctly end-to-end
* DOS/Windows reserved filenames are encoded to avoid failure

Unicode handling is done by more or less ignoring it: we use UTF-8 as our
filesystem encoding in Razor, so we pass through the characters unchanged.

Reserved characters, and filenames, are encoded URI style: percent encoding
with the hex value of the ASCII (aka UTF-8) character. Only basic reserved
characters, and DOS special files, are encoded; Windows / NTFS reserved
filenames are handled by encoding the `$` character.

Signed-off-by: Daniel Pittman