These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

What is a safe separator character for --listformat format strings?

user-2171

Are there any characters (or character sequences) that are guaranteed not to be included in the metadata fields output by listformat? For example, angle brackets, ampersands, or something that's guaranteed to be escaped?

I'd like to use something as a separator, so that it can be easily machine-parsed, like that shown below. However, if there's any chance the separator could appear within a field, it could mess up the parsing.
Code:
flypig@delphinus:~$ get-iplayer --nocopyright --type=radio questions \
                               --listformat "<pid>|<name>|<duration>"

Matches:
b0b01xnk|Any Questions?|3000
b0b0xllc|Any Questions?|3000
b0b1tmbb|Any Questions?|3000
b0b2mrxy|Any Questions?|3000
b0b3g001|Any Questions?|3000
w3cswthd|World Questions|3240
INFO: 6 matching programmes

user-2

Pipe symbol should be fine. That's why it is used in the cache files.

user-2171

Thank you both, that's really helpful. I'll use the pipe then.

@GeoffSmith, you're almost certainly right, it could well be easier to work with the cache, but for historical reasons I'm using the output of a search command and I'd need to properly understand the characteristics of the cache before switching to using that instead (a task for another day).

These forums are archived

See this post for further info