lbcd/claimtrie/normalization/normalizer.go
Roy Lee 6828cf5e36 [lbry] claimtrie: import current snapshot
Sync to tip

Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00

22 lines
640 B
Go

package normalization
import (
"github.com/lbryio/lbcd/claimtrie/param"
)
var Normalize = normalizeGo
var NormalizeTitle = "Normalizing strings via Go. Casefold and NFD table versions: 11.0.0 (from ICU 63.2)"
func NormalizeIfNecessary(name []byte, height int32) []byte {
if height < param.ActiveParams.NormalizedNameForkHeight {
return name
}
return Normalize(name)
}
func normalizeGo(value []byte) []byte {
normalized := decompose(value) // may need to hard-code the version on this
// not using x/text/cases because it does too good of a job; it seems to use v14 tables even when it claims v13
return caseFold(normalized)
}