MCPcopy Create free account
hub / github.com/apache/devlake / unicodeToZh

Function unicodeToZh

backend/plugins/tapd/tasks/shared.go:272–278  ·  view source on GitHub ↗

unicodeToZh converts a string containing Unicode escape sequences to a Chinese string. It returns the converted string and an error if the conversion fails.

(s string)

Source from the content-addressed store, hash-verified

270// unicodeToZh converts a string containing Unicode escape sequences to a Chinese string.
271// It returns the converted string and an error if the conversion fails.
272func unicodeToZh(s string) (string, error) {
273 str, err := strconv.Unquote(strings.Replace(strconv.Quote(s), `\\u`, `\u`, -1))
274 if err != nil {
275 return "", err
276 }
277 return str, nil
278}
279
280// convertUnicode converts the ValueAfterParsed and ValueBeforeParsed fields of a struct to Chinese text.
281// It takes a pointer to a struct and returns an error if the conversion fails.

Callers 2

TestUnicodeToZhFunction · 0.85
convertUnicodeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestUnicodeToZhFunction · 0.68