View Single Post
Old 12-12-2010, 02:46 PM   #96
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Thanks Kovid for your help and explanation.

Attached is an "experimental" build of v1.2 of the Search The Internet add-in. Once a few people have tried it I will update the original post. To recap for anyone new - this build is to solve the issue of passing foreign language names like "De l'inconvénient d'être né" to certain websites which differ in the way they encode them for searches. As Kovid says above Amazon uses 'latin-1' whereas the web standard seems to be 'utf-8'.

My solution in the attached version 1.2 has been to add an additional parameter to the tuple defining the website menus. This fourth parameter is unsurprisingly "Encoding", for which the default (if you specify None) will be 'utf-8', however this can be overridden for a particular website such as Amazon by specifying 'latin-1'.

One note for people upgrading who already have defined custom menus in tweaks in 'stip_search_internet_menus'. Your tweaks value will be incorrect, as the menu definition will only have 3 columns instead of 4. I suggest you add your additional column values to the tweak before you update the plugin/restart. Copy values from the enclosed readme if in doubt. I have coded in some error handling so if it detects not enough columns in your tweaks it will still run but use utf-8 for all urls.

Please let me know if I have introduced any issues with this change.
Attached Files
File Type: zip SearchTheInternet.zip (71.5 KB, 286 views)

Last edited by kiwidude; 12-12-2010 at 03:21 PM. Reason: Bug-fix
kiwidude is offline