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)
| 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. |
| 272 | func 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. |
no outgoing calls