Event JSON
{
"id": "ab3033edd2d3f21104e8ce269eff741051ec396ee9450124d2b16a9e7ef9fca0",
"pubkey": "218238431393959d6c8617a3bd899303a96609b44a644e973891038a7de8622d",
"created_at": 1734718387,
"kind": 1,
"tags": [
[
"client",
"oddbean"
],
[
"e",
"ffca90d2cd45d2cd92d75f00f2eefa08a8ba7424a0adbd302c60ea549b11f6d2",
"",
"root"
],
[
"e",
"5000db20d009041457252c9fa8546ffef27be7e2e6640677ca7ea1d52cc2fe85",
"",
"reply"
],
[
"p",
"218238431393959d6c8617a3bd899303a96609b44a644e973891038a7de8622d"
],
[
"p",
"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
]
],
"content": "Is there an easy way to truncate to a max byte-length using the Go standard library? This is the best answer I could find (after only 1 minute of searching though):\n\nhttps://stackoverflow.com/questions/46415894/golang-truncate-strings-with-special-characters-without-corrupting-data/76502408#76502408\n\nNote that as the answer says, this doesn't understand grapheme clusters, meaning that café can become cafe (depending on normalisation form). Also it involves another pass over the data which, if already known to be UTF-8, is redundant.\n\nThis 3rd party package looks to be the rough equivalent of my Perl module: https://github.com/rivo/uniseg",
"sig": "bba72dfa2dc9c5ebbcf299204004fa7efc501abf2cf63622ebc25fda3143798932023691112b2dc03bc55db656d19ef57744564923867508a09810a5c20bd687"
}