A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/parmsam/lzstring-r/issues/31 below:

Broken round trips of URI encoding/decoding · Issue #31 · parmsam/lzstring-r · GitHub

Reprex:

unstable_full <- list(list(version = 1, class = "ellmer::Turn", props = list(role = "user", 
    contents = list(list(version = 1, class = "ellmer::ContentText", 
        props = list(text = "a"))), tokens = c(0, 0))), list(
    version = 1, class = "ellmer::Turn", props = list(role = "assistant", 
        contents = list(list(version = 1, class = "ellmer::ContentText", 
            props = list(text = "There once was a lady by the river,\nWhose heart was full,\nWho spent her days looking up so,\nAnd day after day she grew.\n\nShe found delight in every turn of view,\nHer eyes wide open wide,\nSo that whenever time seemed long, dear friend,\nYou could trust she'd return."))), 
        tokens = c(23L, 63L))), list(version = 1, class = "ellmer::Turn", 
    props = list(role = "user", contents = list(list(version = 1, 
        class = "ellmer::ContentText", props = list(text = "b"))), 
        tokens = c(0, 0))), list(version = 1, class = "ellmer::Turn", 
    props = list(role = "assistant", contents = list(list(version = 1, 
        class = "ellmer::ContentText", props = list(text = "In the land where love does run wild,\nThere was a lover who didn't care,\nWho believed he would find,\nAnd all the while he searched.\n\nHe spent his days looking for just one girl,\nHis thoughts were pure and clear,\nSo that every year he dreamed,\nOf her presence in the air."))), 
        tokens = c(96L, 63L))))


unstable_full |> jsonlite::serializeJSON() |> lzstring::compressToEncodedURIComponent() |> lzstring::decompressFromEncodedURIComponent() |> jsonlite::unserializeJSON()
#> Error: parse error: invalid object key (must be a string)
#>           e":"character","attributes":{:{},"text"tes":,"value":[{"type
#>                      (right here) ------^
to_empty_string <- list(list(version = 1, class = "ellmer::Turn", props = list(role = "user", 
    contents = list(list(version = 1, class = "ellmer::ContentText", 
        props = list(text = "a"))), tokens = c(0, 0))), list(
    version = 1, class = "ellmer::Turn", props = list(role = "assistant", 
        contents = list(list(version = 1, class = "ellmer::ContentText", props = "She found delight in every turn of view,Her eyes wide open wide,So that whenever time seemed long, dear friend,You could trust she'd return."))), 
        tokens = c(23L, 63L)))

to_empty_string |> jsonlite::serializeJSON() |> lzstring::compressToEncodedURIComponent() |> lzstring::decompressFromEncodedURIComponent()
#> [1] ""
unstable <- list(list(version = 1, class = "ellmer::Turn", props = list(role = "user", 
    contents = list(list(version = 1, class = "ellmer::ContentText", 
        props = list(text = "a"))), tokens = c(0, 0))))

unstable |> jsonlite::serializeJSON() |> lzstring::compressToEncodedURIComponent() |> lzstring::decompressFromEncodedURIComponent() |>
jsonlite::unserializeJSON() |> 
waldo::compare(unstable)
#> `names(old[[1]]$props$contents[[1]]$props)` is absent
#> `names(new[[1]]$props$contents[[1]]$props)` is a character vector ('text')

Created on 2025-05-22 with reprex v2.1.1


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4