10-19-2018, 03:56 PM | #1 |
Zealot
Posts: 107
Karma: 1000
Join Date: Mar 2011
Device: Kindle
|
format of Saved Searches file
I have about 150 search and replace pairs and I'm trying to put them into the sigil_searches.ini file manually. Everything is working out fine, except the replace field includes unicode characters (e.g. āīūḷṇṭḍṁṅ) and they are converting to some sort of hex codes. That wouldn't be a problem, except that they aren't converting correctly. For example ū becomes \xc5 in the file and then shows up as Å« in the saved search dialogue.
Sorry if it seems I don't know what I'm talking about. Because I don't I hope someone can tell me what I might be doing wrong. |
10-19-2018, 04:17 PM | #2 |
Well trained by Cats
Posts: 29,691
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
[stealing your thread] I would like to go the other way Sigil -> Calibre
A Import / Export plugin please |
Advert | |
|
10-19-2018, 04:34 PM | #3 |
Zealot
Posts: 107
Karma: 1000
Join Date: Mar 2011
Device: Kindle
|
Steal away... But I don't understand what you mean. Perhaps my OP wasn't clear. What does this have to do with calibre? Or are you talking about having a way to export saved searches into Calibre. Pardon my ignorance. I didn't even know that Calibre had a saved search feature.
|
10-19-2018, 04:52 PM | #4 | |
Well trained by Cats
Posts: 29,691
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
I use Sigil for my base edits, then switch to Calibre for debug, clean the CSS. Its a toss, for using the toolbag |
|
10-19-2018, 04:55 PM | #5 | ||
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
The thing I do recall was there being a bug with line endings (?) between the Windows/Mac versions... but that was years and years ago (may have been fixed by now). Quote:
Yep, it's under View > Saved Searches. When the Calibre Editor was created, Kovid did a fantastic job of porting pretty much every functionality from Sigil over. |
||
Advert | |
|
10-20-2018, 05:59 AM | #6 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
ā \x101 ī \x12b ū \x16b ḷ \x1e37 ṇ \x1e47 Code:
1\Name=Krishna 1\Find=Krishna 1\Replace=K\x1e5b\x1e63\x1e47\x61 The problem with this idea is that Calibre saves additional information with each entry (case_sensitive, mode, dot_all) that would be lost if you converted it to the Sigil Saved Searches format. For example, the above search looks like this in tweak_book_gui.json: Code:
{ "searches": [ { "case_sensitive": false, "dot_all": false, "find": "Krishna", "mode": "normal", "name": "Krishna", "replace": "Kṛṣṇa" } ], "version": 1} |
|
10-20-2018, 08:18 AM | #7 | |
Zealot
Posts: 107
Karma: 1000
Join Date: Mar 2011
Device: Kindle
|
Quote:
Is there some way to wrap the codes so it is clear where they start and stop? Again, sorry if I am using wrong terminology. |
|
10-21-2018, 06:01 PM | #8 | ||
Bibliophagist
Posts: 34,589
Karma: 144552660
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Quote:
Hmmm... time to quit since my eyes are glazing over. |
||
10-22-2018, 09:01 AM | #9 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
@DNSB is correct. There's not "two different" forms of hex codes being used.
As far as manually creating these files ... more power to you, but that wasn't really taken into consideration when the Saved Searches feature was first implemented. The actual creation of the file is handled by Qt in such a way that the same code will work in cross-platform situations. But since Qt automatically handles things like line endings, it's not likely that a file created on one platform will always be 100% compatible with Sigil on another platform. I will look to see how Qt creates the file, though. Perhaps something in python could be done to change unicode into the hex representation that Sigil expects the file to be in. |
10-22-2018, 09:24 AM | #10 |
Sigil Developer
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
|
This link might be relevant:
https://stackoverflow.com/questions/...e-unicode-well So we could set the encoding for the ini file to be utf-8, and as long as it still groks the ascii with hex codes on input, we should be okay to use that. It will definitely make the ini more user editable. |
10-22-2018, 09:37 AM | #11 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That's the sticking point as I see it. I'm all for it, as long as it doesn't invalidate preexisting files with hex codes. Are you talking about only making the change for this particular preference file (to be safe)?
|
10-22-2018, 11:19 AM | #12 |
Sigil Developer
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
|
I was kind of thinking about doing that for all ini files again as long as it still can grok the ascii/hex code on input. I just like users to be able to read, understand, and even edit all of their Sigil ini files if they so desire.
Alternatively we could all pretty easily create a short python app to convert all Sigil ini files to be utf-8 encoded if needed (a one-time tool) or even add code to Sigil itself if need be to do the conversion. What are your thoughts? |
10-22-2018, 12:00 PM | #13 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm not opposed at all to more human-readable preference files. I just don't want users to have to manually do anything special before installing the latest Sigil update to safeguard their current preferences. Preference continuity on upgrades just isn't something they've ever had to worry about in the past.
|
10-22-2018, 12:06 PM | #14 |
Sigil Developer
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
|
Agreed. The first thing to check is if an ini file is set to be utf-8 encoded, can it still handle hex escapes.
|
10-22-2018, 12:11 PM | #15 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saved searches | abecedarian | Sigil | 5 | 04-14-2017 06:48 PM |
Saved searches : suggestions | Bertrand | Editor | 0 | 05-09-2014 05:58 AM |
Saved searches: right pane | roger64 | Editor | 2 | 04-07-2014 09:40 PM |
Where are searches saved? | travger | Calibre | 2 | 08-26-2012 01:37 PM |
Saved Searches - Using Hierarchy | nynaevelan | Library Management | 10 | 03-28-2011 10:45 PM |