niconiconi on Nostr: How to decode a filesystem file name with scrambled encoding in Python 3. The trick ...
How to decode a filesystem file name with scrambled encoding in Python 3. The trick is `os.listdir("./")` returns a "cooked" Unicode string representation which may damage the string further, but `os.listdir(b"./")` returns a "raw" byte representation. #python
Published at
2026-09-11 01:50:39 UTCEvent JSON
{
"id": "2723513a9945cc0d409a6667b5bfea3b7ec1c032b357122987da6d7735a4ef54",
"pubkey": "c9d683688e5e4cb1bfa183741c2f9a7199c5f8a8efd49c7bdcb0ae145acd4f93",
"created_at": 1789091439,
"kind": 1,
"tags": [
[
"imeta",
"url https://misskey-taube.s3.eu-central-1.wasabisys.com/files/e3a76b46-810c-46bb-8132-23f403fb47b0.png",
"m image/png"
],
[
"t",
"python"
],
[
"proxy",
"https://mk.absturztau.be/notes/aqzv5uyis06i00b8",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://mk.absturztau.be/notes/aqzv5uyis06i00b8",
"pink.momostr"
],
[
"-"
]
],
"content": "How to decode a filesystem file name with scrambled encoding in Python 3. The trick is `os.listdir(\"./\")` returns a \"cooked\" Unicode string representation which may damage the string further, but `os.listdir(b\"./\")` returns a \"raw\" byte representation. #python\nhttps://misskey-taube.s3.eu-central-1.wasabisys.com/files/e3a76b46-810c-46bb-8132-23f403fb47b0.png\n",
"sig": "0a5a4d3daeba7827fa37769f050f18031adc378db87fadf6bd1045956728f37c8551bbf1d1458385e167b1daac6acf47ba44ed7e1bcad49ccdfb92a9be8eedad"
}