postmodern on Nostr: How can you use String#scan or String#=~ with a UTF-8 regex against either an ...
How can you use String#scan or String#=~ with a UTF-8 regex against either an ASCII-8bit String or a force_encoded ASCII-8bit -> UTF-8 String (potentially binary data like an image file)? Should I call String#scrub first?
#ruby
Published at
2024-07-14 03:31:58Event JSON
{
"id": "322148a59f7e9476da91510925c68128d3195171ece904ce32df24fa9dfdedf4",
"pubkey": "ae2c5f0d5767d4845b235502cf6bd6fc541334009c28221ab3d3cb9d9895f437",
"created_at": 1720927918,
"kind": 1,
"tags": [
[
"t",
"ruby"
],
[
"proxy",
"https://ruby.social/users/postmodern/statuses/112782732037456649",
"activitypub"
]
],
"content": "How can you use String#scan or String#=~ with a UTF-8 regex against either an ASCII-8bit String or a force_encoded ASCII-8bit -\u003e UTF-8 String (potentially binary data like an image file)? Should I call String#scrub first?\n#ruby",
"sig": "51e4c5814d69af490383d281bea00bdc967ae5bbf1442df1ae705314e659fda2aeab984c6e8ba56b11caf53bc9329d2b75b9100429f34d395d3838fb35a86f0a"
}