code: func (p *PathSpec) UnicodeSanitize(s string) string {
  	source := []rune(s)
  	target := make([]rune, 0, len(source))
  	var prependHyphen bool
  
  	for i, r := range source {
  		isAllowed := r == '.' || r == '/' || r == '\\' || r == '_' || r == '#' || r == '+' || r == '~'
  		isAllowed = isAllowed || unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r)
  		isAllowed = isAllowed || (r == '%' && i+2 < len(source) && ishex(source[i+1]) && ishex(source[i+2]))
  
  		if isAllowed {
  			if prependHyphen {
  				target = append(target, '-')
  				prependHyphen = false
  			}
  			target = append(target, r)
  		} else if len(target) > 0 && (r == '-' || unicode.IsSpace(r)) {
  			prependHyphen = true
  		}
  	}
  
  	var result string
  
  	if p.RemovePathAccents {
  		// remove accents - see https://blog.golang.org/normalization
  		t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
  		result, _, _ = transform.String(t, string(target))
  	} else {
  		result = string(target)
  	}
  
  	return result
  }
docs: // UnicodeSanitize sanitizes string to be used in Hugo URL's, allowing only
  // a predefined set of special Unicode characters.
  // If RemovePathAccents configuration flag is enabled, Uniccode accents
  // are also removed.
  // Spaces will be replaced with a single hyphen, and sequential hyphens will be reduced to one.