From 235139bced5a9a080a692ce774b5121eaccde820 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 10 Dec 2019 07:40:24 -0400 Subject: [PATCH] Update to utf-code function Fixed #189 --- robotgo.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/robotgo.go b/robotgo.go index 28b6568..5088d87 100644 --- a/robotgo.go +++ b/robotgo.go @@ -700,12 +700,12 @@ func CharCodeAt(s string, n int) rune { func toUC(text string) []string { var uc []string - textQuoted := strconv.QuoteToASCII(text) - textUnquoted := textQuoted[1 : len(textQuoted)-1] + for _, r := range text { + textQ := strconv.QuoteToASCII(string(r)) + textUnQ := textQ[1 : len(textQ)-1] - strUnicodev := strings.Split(textUnquoted, "\\u") - for i := 1; i < len(strUnicodev); i++ { - uc = append(uc, "U"+strUnicodev[i]) + st := strings.Replace(textUnQ, "\\u", "U", -1) + uc = append(uc, st) } return uc