Skip to content

Commit

Permalink
fix: fix keyText in mdd
Browse files Browse the repository at this point in the history
Signed-off-by: Mumulhl <mumulhl.666@gmail.com>
  • Loading branch information
mumu-lhl committed Oct 1, 2024
1 parent e5aecd2 commit 912563f
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lib/src/dict_reader_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,23 +457,17 @@ class DictReader {
keyBlock.sublist(keyStartIndex + _numberWidth, keyEndIndex);
String keyText;

if (_encoding == "UTF-16" && _mdx) {
if (_encoding == "UTF-16") {
keyText = Utf16Decoder().decodeUtf16Le(keyEncoded);
} else {
keyText = utf8.decode(keyEncoded);
}

if (!_mdx) {
var temp = "";
for (var i = 0; i < keyText.length; i += 2) {
temp += keyText[i];
if (!_mdx) {
keyText = keyText.replaceAll("\\", "/");
if (keyText[0] == "/") {
keyText = keyText.substring(1);
}
}

keyText = temp;
}

if (!_mdx) {
keyText = keyText.replaceFirst(r"\", "");
} else {
keyText = utf8.decode(keyEncoded);
}

keyStartIndex = keyEndIndex + width;
Expand Down

0 comments on commit 912563f

Please sign in to comment.