I'm new to Go and I'm trying to implement a function to convert accented characters into their non-accented equivalent. I'm attempting to follow the example given in this blog (see the heading 'Performing magic').
What I've attempted to gather from this is:
package main
import (
"fmt"
"unicode"
"bytes"
"code.google.com/p/go.text/transform"
"code.google.com/p/go.text/unicode/norm"
)
func isMn (r rune) bool {
return unicode.Is(unicode.Mn, r) // Mn: nonspacing marks
}
func main() {
r := bytes.NewBufferString("Your Śtring")
t := transform.Chain(norm.NFD, transform.RemoveFunc(isMn), norm.NFC)
r = transform.NewReader(r, t)
fmt.Println(r)
}
It does not work in the slightest and I quite honestly don't know what it means anyway. Any ideas?