forked from Public-Mirror/Textractor
text encoding fixups
This commit is contained in:
parent
b7c9f0bfce
commit
5d77350e3c
@ -165,7 +165,7 @@ private:
|
||||
dictionaryWindow.UpdateDictionary();
|
||||
if (dictionaryWindow.dictionary.empty())
|
||||
{
|
||||
std::ofstream(DICTIONARY_SAVE_FILE) << DICTIONARY_INSTRUCTIONS;
|
||||
std::ofstream(DICTIONARY_SAVE_FILE) << u8"\ufeff" << DICTIONARY_INSTRUCTIONS;
|
||||
_spawnlp(_P_DETACH, "notepad", "notepad", DICTIONARY_SAVE_FILE, NULL); // show file to user
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,8 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
||||
UpdateReplacements();
|
||||
if (trie.Empty())
|
||||
{
|
||||
std::ofstream(REPLACE_SAVE_FILE, std::ios::binary).write((char*)REPLACER_INSTRUCTIONS, wcslen(REPLACER_INSTRUCTIONS) * sizeof(wchar_t));
|
||||
auto file = std::ofstream(REPLACE_SAVE_FILE, std::ios::binary) << "\xff\xfe";
|
||||
for (auto ch : std::wstring_view(REPLACER_INSTRUCTIONS)) file << (ch == L'\n' ? std::string_view("\r\0\n", 4) : std::string_view((char*)&ch, 2));
|
||||
_spawnlp(_P_DETACH, "notepad", "notepad", REPLACE_SAVE_FILE, NULL); // show file to user
|
||||
}
|
||||
}
|
||||
|
10
text.cpp
10
text.cpp
@ -1,6 +1,4 @@
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef _WIN64
|
||||
#ifdef _WIN64
|
||||
#define ARCH "x64"
|
||||
#else
|
||||
#define ARCH "x86"
|
||||
@ -121,13 +119,13 @@ Click and drag on window edges to move, or the bottom right corner to resize)";
|
||||
const char* TOPMOST = u8"Always on top";
|
||||
const char* DICTIONARY = u8"Dictionary";
|
||||
const char* DICTIONARY_INSTRUCTIONS = u8R"(This file is used only for the "Dictionary" feature of the Extra Window extension.
|
||||
It is not meant to be written manually (though it can be).
|
||||
It uses a custom format specific to Textractor and is not meant to be written manually.
|
||||
You should look for a dictionary in this format online (https://artikash.github.io/?dictionary is a good place to start).
|
||||
Alternatively, if you're a programmer, you can write a script to convert a dictionary from another format with the info below.
|
||||
Once you have a dictionary, to look up some text in Extra Window, select it. All matching definitions will be shown.
|
||||
Definitions are formatted like this:|TERM|Hola|TERM|hola|TERM|Bonjour|TERM|bonjour|DEFINITION|hello|END|
|
||||
The definition can include rich text (https://doc.qt.io/qt-5/richtext-html-subset.html) which will be formatted properly.
|
||||
All text in this file outside of definitions is ignored.
|
||||
All text in this file outside of a definition is ignored.
|
||||
Terms longer than 50 characters may not be shown (for performance reasons that should be fixed soon).
|
||||
This file must be encoded in UTF-8.)";
|
||||
const char* SHOW_ORIGINAL = u8"Original text";
|
||||
@ -170,7 +168,7 @@ Replacement commands must be formatted like this:
|
||||
|ORIG|original_text|BECOMES|replacement_text|END|
|
||||
All text in this file outside of a replacement command is ignored.
|
||||
Whitespace in original_text is ignored, but replacement_text can contain spaces, newlines, etc.
|
||||
This file must be encoded in Unicode (UTF-16 little endian).)";
|
||||
This file must be encoded in Unicode (UTF-16 Little Endian).)";
|
||||
const char* THREAD_LINKER = u8"Thread Linker";
|
||||
const char* LINK = u8"Link";
|
||||
const char* THREAD_LINK_FROM = u8"Thread number to link from";
|
||||
|
Loading…
x
Reference in New Issue
Block a user