Quote:
Originally Posted by isarl
(At first I thought the Calibre template function to_hex() might be useful, but it hex-encodes the entire string, and without the “%” character. Not really what we want here.)
|
Actually, to_hex() is exactly what you want. If you use it then you don't do any url encoding.
Libraries that are hex encoded must start with '_hex_-'.
Here is an example of building a calibre:// url using the function.
Code:
program:
lib = 'library.test_small';
hex_lib = '_hex_-' & to_hex(lib);
url = 'calibre://book-details/' & hex_lib & '/' & $id;
'<a href="' & url & '">Book id ' & $id & '</a>'
It produces links that look like
Code:
calibre://book-details/_hex_-6c6962726172792e746573745f736d616c6c/1385
You can also use it for query strings. Instead of q=string, you use eq=hex-encoded-string.
All of this is documented here.