PDA

View Full Version : How to encode Favorites URL via CLI



jkish
2009-05-02, 19:34
The CLI favorites add command takes a url parameter.

For an album, the url looks like:

db:album.titlesearch=<album name>

If I URL encode an album name with spaces in it, I get a url that looks like this: db:album.titlesearch=album%20name . If I send a favorites add CLI command with that url, the url I see in the SC web interface has a space in it instead of %20. But, favorites created via the web interface have a url with a %20 in place of a space.

How should I encode the Url submitted via CLI so that SC is happy with it?

mherger
2009-05-04, 01:13
> space in it instead of %20. But, favorites created via the web interface
> have a url with a %20 in place of a space.

Does your version fail?

> How should I encode the Url submitted via CLI so that SC is happy with
> it?

I'm not sure whether you'd actually need to double-encode the url, as the
resulting string should be URL encoded, and CLI is expecting any string to
be URL encoded too.

jkish
2009-05-04, 10:38
Yes, my version fails.

Double encoding was the next thing I tried, but it appears that certain characters, '% and probably others, must be converted to spaces before double encoding.

For example, "Aerosmith's Greatest Hits" must end up looking like "AEROSMITH%20S%20GREATEST%20HITS" to work. So you have to convert the album name to look like that and then encode it before submitting via CLI.