Skip to content

Instantly share code, notes, and snippets.

@mynameiskreang
Created February 27, 2022 16:50
Show Gist options
  • Save mynameiskreang/17503afed51af9cecd80c8df48123a23 to your computer and use it in GitHub Desktop.
Save mynameiskreang/17503afed51af9cecd80c8df48123a23 to your computer and use it in GitHub Desktop.
type Input struct {
SenderName string `json:"sender_name"`
Content string `json:"content"`
Type string `json:"type"`
}
func main() {
//bs, _ := ioutil.ReadFile("./input.json")
bs := `{
"sender_name": "Kreang \u00e0\u00b9\u0080\u00e0\u00b8\u0081\u00e0\u00b8\u00b5\u00e0\u00b8\u00a2\u00e0\u00b8\u0087",
"timestamp_ms": 1638599904881,
"content": "\u00e0\u00b8\u00aa\u00e0\u00b8\u0099\u00e0\u00b9\u0083\u00e0\u00b8\u0088 \u00e0\u00b8\u0082\u00e0\u00b8\u00ad\u00e0\u00b8\u00a3\u00e0\u00b8\u00b2\u00e0\u00b8\u00a2\u00e0\u00b8\u00a5\u00e0\u00b8\u00b0\u00e0\u00b9\u0080\u00e0\u00b8\u00ad\u00e0\u00b8\u00b5\u00e0\u00b8\u00a2\u00e0\u00b8\u0094\u00e0\u00b9\u0084\u00e0\u00b8\u0094\u00e0\u00b9\u0089\u00e0\u00b9\u0084\u00e0\u00b8\u00ab\u00e0\u00b8\u00a1\u00e0\u00b8\u0084\u00e0\u00b8\u00a3\u00e0\u00b8\u00b1\u00e0\u00b8\u009a",
"type": "Generic",
"is_unsent": false
}`
input := Input{}
json.Unmarshal([]byte(bs), &input)
var uint8List []uint8
for _, v := range input.SenderName {
uint8List = append(uint8List, uint8(v))
}
fmt.Println(string(uint8List))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment