View Single Post
Old 10-23-2018, 09:51 AM   #23
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,627
Karma: 5433388
Join Date: Nov 2009
Device: many
Okay, using Doitsu's example, I manually edited the sigil_searches.ini file and added a 34th entry and changed the final line size to be 34

Here is a snippet of my new sigil_searches.ini file:

Code:
34\Find=Krishna
34\Name=Krishna
34\Replace=K\x1e5b\x1e63\x1e47\x61
4\Find="&(nbsp|#160);(</p>)"
4\Name=Example Searches/Remove Non-Breaking Spaces/Trailing space
4\Replace=\\2
5\Find="(<p[^>]*>)&(nbsp|#160);"
5\Name=Example Searches/Remove Non-Breaking Spaces/Leading space
5\Replace=\\1
6\Find=\x2002
6\Name=Example Searches/Convert Characters to Entities/ensp
6\Replace="&ensp;"
7\Find=\x2003
7\Name=Example Searches/Convert Characters to Entities/emsp
7\Replace="&emsp;"
8\Find=\x2009
8\Name=Example Searches/Convert Characters to Entities/thin space
8\Replace="&thinsp;"
9\Find=\xad
9\Name=Example Searches/Convert Characters to Entities/shy
9\Replace="­"
size=34
Next I edited Sigil/src/MiscEditors/SearchEditorModel.cpp and added a call to use setIniCodec immediately after creating the settings instance as follows:

Code:
void SearchEditorModel::LoadData(const QString &filename, QStandardItem *item)
{
    SettingsStore *settings;

    if (filename.isEmpty()) {
        settings = new SettingsStore(m_SettingsPath);
    } else {
        settings = new SettingsStore(filename);
    }

    settings->setIniCodec("UTF-8");

    int size = settings->beginReadArray(SETTINGS_GROUP);
Then I rebuilt Sigil and fired it up and added the following line to my html file:
Code:
<p> this is a test: Krishna</p>
Next I went to Tools->Saved Searches and chose Krishna and ran the find and replace on it and received the correct result:

Kṛṣṇa

So, at least for Saved Searches Find and Replace, setting the ini Codec to utf-8 did the right thing. I am not sure how that would work with general "clips" so we will need to check it as well.
KevinH is offline   Reply With Quote