out := ascii.Convert("Trời hôm nay đẹp quá") // Troi hom nay dep qua
Running example
package main
import(
"github.com/thanhpk/ascii"
"fmt"
)
func main() {
fmt.Println(ascii.Convert("Nam quốc sơn hà mam đế cư"))
fmt.Println(ascii.Convert("Cuántos años tienes"))
fmt.Println(ascii.Convert("AppleInc 是苹果公司."))
}
// Output:
// Nam quoc son ha mam de cu
// Cuantos anos tienes
// AppleInc .
Convert replaces all non-ascii characters to equivalent ascii characters
e.g: â => a, đ => d, ...
To ensure the output string is pure ascii, this function remove all
characters that does not have equivalent ascii character, for example: 主