mirror of https://github.com/WerWolv/ImHex.git
fix: UTF-16BE search being broken
This commit is contained in:
parent
88e767aaaf
commit
cffd55bdda
|
@ -520,9 +520,6 @@ namespace hex::plugin::builtin {
|
|||
std::vector<u8> bytes(std::min<size_t>(occurrence.region.getSize(), 128));
|
||||
provider->read(occurrence.region.getStartAddress(), bytes.data(), bytes.size());
|
||||
|
||||
if (occurrence.endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
|
||||
std::string result;
|
||||
switch (this->m_decodeSettings.mode) {
|
||||
using enum SearchSettings::Mode;
|
||||
|
@ -537,7 +534,7 @@ namespace hex::plugin::builtin {
|
|||
result = hex::encodeByteString(bytes);
|
||||
break;
|
||||
case UTF16:
|
||||
for (size_t i = 0; i < bytes.size(); i += 2)
|
||||
for (size_t i = occurrence.endian == std::endian::little ? 0 : 1; i < bytes.size(); i += 2)
|
||||
result += hex::encodeByteString({ bytes[i] });
|
||||
break;
|
||||
case Unsigned:
|
||||
|
|
Loading…
Reference in New Issue