github.com/lbryio/lbcd@v0.22.119/claimtrie/normalization/normalizer.go (about)

     1  package normalization
     2  
     3  import (
     4  	"github.com/lbryio/lbcd/claimtrie/param"
     5  )
     6  
     7  var Normalize = normalizeGo
     8  var NormalizeTitle = "Normalizing strings via Go. Casefold and NFD table versions: 11.0.0 (from ICU 63.2)"
     9  
    10  func NormalizeIfNecessary(name []byte, height int32) []byte {
    11  	if height < param.ActiveParams.NormalizedNameForkHeight {
    12  		return name
    13  	}
    14  	return Normalize(name)
    15  }
    16  
    17  func normalizeGo(value []byte) []byte {
    18  
    19  	normalized := decompose(value) // may need to hard-code the version on this
    20  	// not using x/text/cases because it does too good of a job; it seems to use v14 tables even when it claims v13
    21  	return caseFold(normalized)
    22  }