Matmaus / LnkParse3

Windows Shortcut file (LNK) parser
MIT License
71 stars 13 forks source link

Error while decoding string containing japanese characters #31

Open dgbogi564 opened 5 months ago

dgbogi564 commented 5 months ago

With this .lnk file (inside zip) as input, when I run this code:

def get_target(lnk_path):
    with open(lnk_path, "rb") as indata:
        return LnkParse3.lnk_file(indata).info.local_base_path()

print(get_target(lnk_path))

I receive this error (path :

UserWarning: Error while decoding string `F:\笹���も (@sasakomitomo)` ('charmap' codec can't decode byte 0x8f in position 58: character maps to <undefined>)
  warnings.warn(msg)
dgbogi564 commented 5 months ago

I tried experimenting with various codepages, but none seem to consistently work with this set of lnk files. The best results I've gotten have been through utf-8:

F:\???????????? ?? (@IndigoBeatss)

According to liblnk's documentation, unicode strings are stored as utf-16le, but when I try it I get results like this:

㩆捜汯敬瑣潩屮汤屳楨潴業搭屬楨潴業摟睯汮慯敤彤睴瑩整屲㼿㼿㼿㼿㼿㼿㼠‿䀨湉楤潧敂瑡獳�
Matmaus commented 5 months ago

Hi, I check file from the first ZIP and I think the parsing is correct. You are right that Unicode strings are stored in UTF-16 but in this case LinkInfo part does not contain LocalBasePathUnicode. The failing one is LocalBasePath. I think you have to provide the correct codepage (I dont know which one). Down below you can see the raw data:

# Local base path: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹���も (@sasakomitomo)
>>> self.info._raw[ self.info.local_base_path_offset() : self.info.size() ]
b'F:\\collection\\dls\\hitomi-dl\\hitomi_downloaded_twitter\\\xe7\xac\xb9\xe5\x8f\xa4\xe3\x81\xbf\xe3\x81\xa8\xe3\x82\x82 (@sasakomitomo)\x00\x00'
# Relative path: ..\..\..\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)
>>> self.string_data._raw[2:164]
b'.\x00.\x00\\\x00.\x00.\x00\\\x00.\x00.\x00\\\x00c\x00o\x00l\x00l\x00e\x00c\x00t\x00i\x00o\x00n\x00\\\x00d\x00l\x00s\x00\\\x00h\x00i\x00t\x00o\x00m\x00i\x00-\x00d\x00l\x00\\\x00h\x00i\x00t\x00o\x00m\x00i\x00_\x00d\x00o\x00w\x00n\x00l\x00o\x00a\x00d\x00e\x00d\x00_\x00t\x00w\x00i\x00t\x00t\x00e\x00r\x00\\\x009{\xe4S\x7f0h0\x820 \x00(\x00@\x00s\x00a\x00s\x00a\x00k\x00o\x00m\x00i\x00t\x00o\x00m\x00o\x00)\x00'
# Value: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)
>>> [e for e in self.extras][1]._raw[103:249]
b'F\x00:\x00\\\x00c\x00o\x00l\x00l\x00e\x00c\x00t\x00i\x00o\x00n\x00\\\x00d\x00l\x00s\x00\\\x00h\x00i\x00t\x00o\x00m\x00i\x00-\x00d\x00l\x00)\x00\x00\x00\x00\x00\x00\x00\x82\x00\x00\x001SPS0\xf1%\xb7\xefG\x1a\x10\xa5\xf1\x02`\x8c\x9e\xeb\xac=\x00\x00\x00\n\x00\x00\x00\x00\x1f\x00\x00\x00\x16\x00\x00\x009{\xe4S\x7f0h0\x820 \x00(\x00@\x00s\x00a\x00s\x00a\x00k\x00o\x00m\x00i\x00t\x00o\x00m\x00o\x00)\x00\x00'

Here is complete output:

Windows Shortcut Information:
   Link CLSID: 00021401-0000-0000-C000-000000000046
   Link Flags: HasTargetIDList | HasLinkInfo | HasRelativePath | IsUnicode | EnableTargetMetadata - (524427)
   File Flags: FILE_ATTRIBUTE_DIRECTORY - (16)

   Creation Timestamp: 2023-05-27 01:51:30.558322+00:00
   Modified Timestamp: 2023-10-15 07:15:51.716984+00:00
   Accessed Timestamp: 2023-10-18 00:31:36.907479+00:00

   Icon Index: 0
   Window Style: SW_SHOWNORMAL
   HotKey: UNSET - UNSET {0x0000}

   TARGETS:
      Index: 78
      ITEMS:
         Root Folder
            Sort index: Internet Explorer
            Guid: B710002F-F5A6-0019-2F46-3A5C00000000
         File entry
            Flags: Is directory
            Modification time: None
            File attribute flags: 16
            Primary name: collection
         File entry
            Flags: Is directory
            Modification time: None
            File attribute flags: 16
            Primary name: dls
         File entry
            Flags: Is directory
            Modification time: None
            File attribute flags: 16
            Primary name: hitomi-dl
         File entry
            Flags: Is directory
            Modification time: None
            File attribute flags: 16
            Primary name: hitomi_downloaded_twitter
         File entry

   LINK INFO:
      Link info flags: 1
      Local base path: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹���も (@sasakomitomo)
      Common path suffix:
      LOCAL:
         Drive type: 3
         Drive serial number: 0x280e8914
         Drive type: DRIVE_FIXED
         Volume label:

   DATA
      Relative path: ..\..\..\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)

   EXTRA BLOCKS:
      DISTRIBUTED_LINK_TRACKER_BLOCK
         Length: 88
         Version: 0
         Machine identifier: trigun
         Droid volume identifier: 056C316C-9975-46CC-A56F-3CF14020D396
         Droid file identifier: D8F800EC-6D46-11EE-AE84-5E99434149B5
         Birth droid volume identifier: 056C316C-9975-46CC-A56F-3CF14020D396
         Birth droid file identifier: D8F800EC-6D46-11EE-AE84-5E99434149B5
      METADATA_PROPERTIES_BLOCK
         Property store:
            Storage:
               Version: 0x53505331
               Format id: DABD30ED-0043-4789-A7F8-D013A4736622
               Serialized property values:
                  Property:
                     Id: 100
                     Value: hitomi_downloaded_twitter (F:\collection\dls\hitomi-dl)
                     Value type: VT_LPWSTR
            Storage:
               Version: 0x53505331
               Format id: B725F130-47EF-101A-A5F1-02608C9EEBAC
               Serialized property values:
                  Property:
                     Id: 10
                     Value: 笹古みとも (@sasakomitomo)
                     Value type: VT_LPWSTR
                  Property:
                     Id: 4
                     Value: File folder
                     Value type: VT_LPWSTR
            Storage:
               Version: 0x53505331
               Format id: 28636AA6-953D-11D2-B5D6-00C04FD918D0
               Serialized property values:
                  Property:
                     Id: 30
                     Value: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)
                     Value type: VT_LPWSTR
            Storage:
               Version: 0x53505331
               Format id: 446D16B1-8DAD-4870-A748-402EA43D788C
               Serialized property values:
                  Property:
                     Id: 104
                     Value: None
                     Value type: VT_CLSID
dgbogi564 commented 5 months ago

I've tried every codepage identifier listed here but none seem to work...

Test script ```python import sys import LnkParse3 # https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers code_page_identifiers = [ ("037", "IBM037", "IBM EBCDIC US-Canada"), ("437", "IBM437", "OEM United States"), ("500", "IBM500", "IBM EBCDIC International"), ("708", "ASMO-708", "Arabic (ASMO 708)"), ("709", None, "Arabic (ASMO-449+, BCON V4)"), ("710", None, "Arabic - Transparent Arabic"), ("720", "DOS-720", "Arabic (Transparent ASMO); Arabic (DOS)"), ("737", "ibm737", "OEM Greek (formerly 437G); Greek (DOS)"), ("775", "ibm775", "OEM Baltic; Baltic (DOS)"), ("850", "ibm850", "OEM Multilingual Latin 1; Western European (DOS)"), ("852", "ibm852", "OEM Latin 2; Central European (DOS)"), ("855", "IBM855", "OEM Cyrillic (primarily Russian)"), ("857", "ibm857", "OEM Turkish; Turkish (DOS)"), ("858", "IBM00858", "OEM Multilingual Latin 1 + Euro symbol"), ("860", "IBM860", "OEM Portuguese; Portuguese (DOS)"), ("861", "ibm861", "OEM Icelandic; Icelandic (DOS)"), ("862", "DOS-862", "OEM Hebrew; Hebrew (DOS)"), ("863", "IBM863", "OEM French Canadian; French Canadian (DOS)"), ("864", "IBM864", "OEM Arabic; Arabic (864)"), ("865", "IBM865", "OEM Nordic; Nordic (DOS)"), ("866", "cp866", "OEM Russian; Cyrillic (DOS)"), ("869", "ibm869", "OEM Modern Greek; Greek, Modern (DOS)"), ("870", "IBM870", "IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2"), ("874", "windows-874", "Thai (Windows)"), ("875", "cp875", "IBM EBCDIC Greek Modern"), ("932", "shift_jis", "ANSI/OEM Japanese; Japanese (Shift-JIS)"), ("936", "gb2312", "ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312)"), ("949", "ks_c_5601-1987", "ANSI/OEM Korean (Unified Hangul Code)"), ("950", "big5", "ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)"), ("1026", "IBM1026", "IBM EBCDIC Turkish (Latin 5)"), ("1047", "IBM01047", "IBM EBCDIC Latin 1/Open System"), ("1140", "IBM01140", "IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro)"), ("1141", "IBM01141", "IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro)"), ("1142", "IBM01142", "IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro)"), ("1143", "IBM01143", "IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro)"), ("1144", "IBM01144", "IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro)"), ("1145", "IBM01145", "IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro)"), ("1146", "IBM01146", "IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro)"), ("1147", "IBM01147", "IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro)"), ("1148", "IBM01148", "IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro)"), ("1149", "IBM01149", "IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro)"), ("1200", "utf-16", "Unicode UTF-16, little endian byte order (BMP of ISO 10646); available only to managed applications"), ("1201", "unicodeFFFE", "Unicode UTF-16, big endian byte order; available only to managed applications"), ("1250", "windows-1250", "ANSI Central European; Central European (Windows)"), ("1251", "windows-1251", "ANSI Cyrillic; Cyrillic (Windows)"), ("1252", "windows-1252", "ANSI Latin 1; Western European (Windows)"), ("1253", "windows-1253", "ANSI Greek; Greek (Windows)"), ("1254", "windows-1254", "ANSI Turkish; Turkish (Windows)"), ("1255", "windows-1255", "ANSI Hebrew; Hebrew (Windows)"), ("1256", "windows-1256", "ANSI Arabic; Arabic (Windows)"), ("1257", "windows-1257", "ANSI Baltic; Baltic (Windows)"), ("1258", "windows-1258", "ANSI/OEM Vietnamese; Vietnamese (Windows)"), ("1361", "Johab", "Korean (Johab)"), ("10000", "macintosh", "MAC Roman; Western European (Mac)"), ("10001", "x-mac-japanese", "Japanese (Mac)"), ("10002", "x-mac-chinesetrad", "MAC Traditional Chinese (Big5); Chinese Traditional (Mac)"), ("10003", "x-mac-korean", "Korean (Mac)"), ("10004", "x-mac-arabic", "Arabic (Mac)"), ("10005", "x-mac-hebrew", "Hebrew (Mac)"), ("10006", "x-mac-greek", "Greek (Mac)"), ("10007", "x-mac-cyrillic", "Cyrillic (Mac)"), ("10008", "x-mac-chinesesimp", "MAC Simplified Chinese (GB 2312); Chinese Simplified (Mac)"), ("10010", "x-mac-romanian", "Romanian (Mac)"), ("10017", "x-mac-ukrainian", "Ukrainian (Mac)"), ("10021", "x-mac-thai", "Thai (Mac)"), ("10029", "x-mac-ce", "MAC Latin 2; Central European (Mac)"), ("10079", "x-mac-icelandic", "Icelandic (Mac)"), ("10081", "x-mac-turkish", "Turkish (Mac)"), ("10082", "x-mac-croatian", "Croatian (Mac)"), ("12000", "utf-32", "Unicode UTF-32, little endian byte order; available only to managed applications"), ("12001", "utf-32BE", "Unicode UTF-32, big endian byte order; available only to managed applications"), ("20000", "x-Chinese_CNS", "CNS Taiwan; Chinese Traditional (CNS)"), ("20001", "x-cp20001", "TCA Taiwan"), ("20002", "x_Chinese-Eten", "Eten Taiwan; Chinese Traditional (Eten)"), ("20003", "x-cp20003", "IBM5550 Taiwan"), ("20004", "x-cp20004", "TeleText Taiwan"), ("20005", "x-cp20005", "Wang Taiwan"), ("20105", "x-IA5", "IA5 (IRV International Alphabet No. 5, 7-bit); Western European (IA5)"), ("20106", "x-IA5-German", "IA5 German (7-bit)"), ("20107", "x-IA5-Swedish", "IA5 Swedish (7-bit)"), ("20108", "x-IA5-Norwegian", "IA5 Norwegian (7-bit)"), ("20127", "us-ascii", "US-ASCII (7-bit)"), ("20261", "x-cp20261", "T.61"), ("20269", "x-cp20269", "ISO 6937 Non-Spacing Accent"), ("20273", "IBM273", "IBM EBCDIC Germany"), ("20277", "IBM277", "IBM EBCDIC Denmark-Norway"), ("20278", "IBM278", "IBM EBCDIC Finland-Sweden"), ("20280", "IBM280", "IBM EBCDIC Italy"), ("20284", "IBM284", "IBM EBCDIC Latin America-Spain"), ("20285", "IBM285", "IBM EBCDIC United Kingdom"), ("20290", "IBM290", "IBM EBCDIC Japanese Katakana Extended"), ("20297", "IBM297", "IBM EBCDIC France"), ("20420", "IBM420", "IBM EBCDIC Arabic"), ("20423", "IBM423", "IBM EBCDIC Greek"), ("20424", "IBM424", "IBM EBCDIC Hebrew"), ("20833", "x-EBCDIC-KoreanExtended", "IBM EBCDIC Korean Extended"), ("20838", "IBM-Thai", "IBM EBCDIC Thai"), ("20866", "koi8-r", "Russian (KOI8-R); Cyrillic (KOI8-R)"), ("20871", "IBM871", "IBM EBCDIC Icelandic"), ("20880", "IBM880", "IBM EBCDIC Cyrillic Russian"), ("20905", "IBM905", "IBM EBCDIC Turkish"), ("20924", "IBM00924", "IBM EBCDIC Latin 1/Open System (1047 + Euro symbol)"), ("20932", "EUC-JP", "Japanese (JIS 0208-1990 and 0212-1990)"), ("20936", "x-cp20936", "Simplified Chinese (GB2312); Chinese Simplified (GB2312-80)"), ("20949", "x-cp20949", "Korean Wansung"), ("21025", "cp1025", "IBM EBCDIC Cyrillic Serbian-Bulgarian"), ("21027", None, "(deprecated)"), ("21866", "koi8-u", "Ukrainian (KOI8-U); Cyrillic (KOI8-U)"), ("28591", "iso-8859-1", "ISO 8859-1 Latin 1; Western European (ISO)"), ("28592", "iso-8859-2", "ISO 8859-2 Central European; Central European (ISO)"), ("28593", "iso-8859-3", "ISO 8859-3 Latin 3"), ("28594", "iso-8859-4", "ISO 8859-4 Baltic"), ("28595", "iso-8859-5", "ISO 8859-5 Cyrillic"), ("28596", "iso-8859-6", "ISO 8859-6 Arabic"), ("28597", "iso-8859-7", "ISO 8859-7 Greek"), ("28598", "iso-8859-8", "ISO 8859-8 Hebrew; Hebrew (ISO-Visual)"), ("28599", "iso-8859-9", "ISO 8859-9 Turkish"), ("28603", "iso-8859-13", "ISO 8859-13 Estonian"), ("28605", "iso-8859-15", "ISO 8859-15 Latin 9"), ("29001", "x-Europa", "Europa 3"), ("38598", "iso-8859-8-i", "ISO 8859-8 Hebrew; Hebrew (ISO-Logical)"), ("50220", "iso-2022-jp", "ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS)"), ("50221", "csISO2022JP", "ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana)"), ("50222", "iso-2022-jp", "ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI)"), ("50225", "iso-2022-kr", "ISO 2022 Korean"), ("50227", "x-cp50227", "ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022)"), ("50229", "ISO", "2022 Traditional Chinese"), ("50930", None, "EBCDIC Japanese (Katakana) Extended"), ("50931", None, "EBCDIC US-Canada and Japanese"), ("50933", None, "EBCDIC Korean Extended and Korean"), ("50935", None, "EBCDIC Simplified Chinese Extended and Simplified Chinese"), ("50936", None, "EBCDIC Simplified Chinese"), ("50937", None, "EBCDIC US-Canada and Traditional Chinese"), ("50939", None, "EBCDIC Japanese (Latin) Extended and Japanese"), ("51932", "euc-jp", "EUC Japanese"), ("51936", "EUC-CN", "EUC Simplified Chinese; Chinese Simplified (EUC)"), ("51949", "euc-kr", "EUC Korean"), ("51950", "EUC", "Traditional Chinese"), ("52936", "hz-gb-2312", "HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ)"), ("54936", "GB18030", "Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030)"), ("57002", "x-iscii-de", "ISCII Devanagari"), ("57003", "x-iscii-be", "ISCII Bangla"), ("57004", "x-iscii-ta", "ISCII Tamil"), ("57005", "x-iscii-te", "ISCII Telugu"), ("57006", "x-iscii-as", "ISCII Assamese"), ("57007", "x-iscii-or", "ISCII Odia"), ("57008", "x-iscii-ka", "ISCII Kannada"), ("57009", "x-iscii-ma", "ISCII Malayalam"), ("57010", "x-iscii-gu", "ISCII Gujarati"), ("57011", "x-iscii-pa", "ISCII Punjabi"), ("65000", "utf-7", "Unicode (UTF-7)"), ("65001", "utf-8", "Unicode (UTF-8)"), ] def get_target(lnk_path, code_page): with open(lnk_path, "rb") as indata: lnk_file = LnkParse3.lnk_file(indata, cp=code_page) return lnk_file.info.local_base_path() if __name__ == '__main__': lnk_path = sys.argv[1] print("====lnk file info=====") with open(lnk_path, "rb") as indata: LnkParse3.lnk_file(indata).print_lnk_file() print("=========test=========") for identifier, net_name, additional_info in code_page_identifiers: print(f'{identifier}, {net_name}, {additional_info}') try: print(f'{get_target(lnk_path, identifier)}\n') except Exception as e: print(f'{e}\n') ```
Output ```cmd D:\libraries\repositories\dev\shortcut2symlink\.venv\Scripts\python.exe D:\libraries\repositories\dev\shortcut2symlink\test.py "F:\workspace\inspiration\DUMP\笹古みとも (@sasakomitomo).lnk" D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ã�¿ã�¨ã‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x8f in position 58: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\�¼╣ÕÅñÒü┐Òü¿Òéé (@sasakomitomo)` ('charmap' codec can't decode byte 0xe7 in position 54: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\νΘ╣λΉΑι�┐ι�Ει�� (@sasakomitomo)` ('charmap' codec can't decode byte 0x81 in position 61: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\隨ケ蜿、縺ソ縺ィ繧� (@sasakomitomo)` ('cp932' codec can't decode byte 0x82 in position 68: illegal multibyte sequence) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\绗瑰彜銇裤仺銈� (@sasakomitomo)` ('gbk' codec can't decode byte 0x82 in position 68: illegal multibyte sequence) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\寧밧룮�겳�겏�굚 (@sasakomitomo)` ('cp949' codec can't decode byte 0xe3 in position 60: illegal multibyte sequence) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\蝚孵�扎�踴�具�� (@sasakomitomo)` ('cp950' codec can't decode byte 0x8f in position 58: illegal multibyte sequence) warnings.warn(msg) ====lnk file info===== Windows Shortcut Information: Link CLSID: 00021401-0000-0000-C000-000000000046 Link Flags: HasTargetIDList | HasLinkInfo | HasRelativePath | IsUnicode | EnableTargetMetadata - (524427) File Flags: FILE_ATTRIBUTE_DIRECTORY - (16) Creation Timestamp: 2023-05-27 01:51:30.558322+00:00 Modified Timestamp: 2023-10-15 07:15:51.716984+00:00 Accessed Timestamp: 2023-10-18 00:31:36.907479+00:00 Icon Index: 0 Window Style: SW_SHOWNORMAL HotKey: UNSET - UNSET {0x0000} TARGETS: Index: 78 ITEMS: Root Folder Sort index: Internet Explorer Guid: B710002F-F5A6-0019-2F46-3A5C00000000 File entry Flags: Is directory Modification time: None File attribute flags: 16 Primary name: collection File entry Flags: Is directory Modification time: None File attribute flags: 16 Primary name: dls File entry Flags: Is directory Modification time: None File attribute flags: 16 Primary name: hitomi-dl File entry Flags: Is directory Modification time: None File attribute flags: 16 Primary name: hitomi_downloaded_twitter File entry LINK INFO: Link info flags: 1 Local base path: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ã�¿ã�¨ã‚‚ (@sasakomitomo) Common path suffix: LOCAL: Drive type: 3 Drive serial number: 0x280e8914 Drive type: DRIVE_FIXED Volume label: DATA Relative path: ..\..\..\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo) EXTRA BLOCKS: DISTRIBUTED_LINK_TRACKER_BLOCK Length: 88 Version: 0 Machine identifier: trigun Droid volume identifier: 056C316C-9975-46CC-A56F-3CF14020D396 Droid file identifier: D8F800EC-6D46-11EE-AE84-5E99434149B5 Birth droid volume identifier: 056C316C-9975-46CC-A56F-3CF14020D396 Birth droid file identifier: D8F800EC-6D46-11EE-AE84-5E99434149B5 METADATA_PROPERTIES_BLOCK Property store: Storage: Version: 0x53505331 Format id: DABD30ED-0043-4789-A7F8-D013A4736622 Serialized property values: Property: Id: 100 Value: hitomi_downloaded_twitter (F:\collection\dls\hitomi-dl) Value type: VT_LPWSTR Storage: Version: 0x53505331 Format id: B725F130-47EF-101A-A5F1-02608C9EEBAC Serialized property values: Property: Id: 10 Value: 笹古みとも (@sasakomitomo) Value type: VT_LPWSTR Property: Id: 4 Value: File folder Value type: VT_LPWSTR Storage: Version: 0x53505331 Format id: 28636AA6-953D-11D2-B5D6-00C04FD918D0 Serialized property values: Property: Id: 30 Value: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo) Value type: VT_LPWSTR Storage: Version: 0x53505331 Format id: 446D16B1-8DAD-4870-A748-402EA43D788C Serialized property values: Property: Id: 104 Value: None Value type: VT_CLSID =========test========= 037, IBM037, IBM EBCDIC US-Canada ãš*Ä?%%ÁÄÈÑ?>*À%Ë*ÇÑÈ?_ÑÀ%*ÇÑÈ?_ѬÀ?Ï>%?/ÀÁÀ¬ÈÏÑÈÈÁÊ*XоV±uTa×TayTbb€ˆ Ë/Ë/,?_ÑÈ?_?‰ 437, IBM437, OEM United States F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σÅñπü┐πü¿πéé (@sasakomitomo) 500, IBM500, IBM EBCDIC International ãš*Ä?%%ÁÄÈÑ?>*À%Ë*ÇÑÈ?_ÑÀ%*ÇÑÈ?_Ñ^À?Ï>%?/ÀÁÀ^ÈÏÑÈÈÁÊ*XоV±uTa×TayTbb€ˆ Ë/Ë/,?_ÑÈ?_?‰ 708, ASMO-708, Arabic (ASMO 708) unknown encoding: 708 709, None, Arabic (ASMO-449+, BCON V4) unknown encoding: 709 710, None, Arabic - Transparent Arabic unknown encoding: 710 720, DOS-720, Arabic (Transparent ASMO); Arabic (DOS) unknown encoding: 720 737, ibm737, OEM Greek (formerly 437G); Greek (DOS) unknown encoding: 737 775, ibm775, OEM Baltic; Baltic (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ń¼╣ÕÅżŃü┐Ńü©Ńéé (@sasakomitomo) 850, ibm850, OEM Multilingual Latin 1; Western European (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\þ¼╣ÕÅñÒü┐Òü¿Òéé (@sasakomitomo) 852, ibm852, OEM Latin 2; Central European (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\šČ╣ňĆĄŃü┐ŃüĘŃéé (@sasakomitomo) 855, IBM855, OEM Cyrillic (primarily Russian) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\уг╣тЈцсЂ┐сЂесѓѓ (@sasakomitomo) 857, ibm857, OEM Turkish; Turkish (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\�¼╣ÕÅñÒü┐Òü¿Òéé (@sasakomitomo) 858, IBM00858, OEM Multilingual Latin 1 + Euro symbol F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\þ¼╣ÕÅñÒü┐Òü¿Òéé (@sasakomitomo) 860, IBM860, OEM Portuguese; Portuguese (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σÂñπü┐πü¿πéé (@sasakomitomo) 861, ibm861, OEM Icelandic; Icelandic (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σÅÁπü┐πü¿πéé (@sasakomitomo) 862, DOS-862, OEM Hebrew; Hebrew (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σןñπב┐πב¿πגג (@sasakomitomo) 863, IBM863, OEM French Canadian; French Canadian (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σ§¨πü┐πüÎπéé (@sasakomitomo) 864, IBM864, OEM Arabic; Arabic (864) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ﻫ،٩ﻣ┘¤ﻛ·؟ﻛ·ﺎﻛ∙∙ (@sasakomitomo) 865, IBM865, OEM Nordic; Nordic (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\τ¼╣σÅñπü┐πü¿πéé (@sasakomitomo) 866, cp866, OEM Russian; Cyrillic (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\чм╣хПдуБ┐уБиуВВ (@sasakomitomo) 869, ibm869, OEM Modern Greek; Greek, Modern (DOS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\νΘ╣λΉΑι�┐ι�Ει�� (@sasakomitomo) 870, IBM870, IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2 unknown encoding: 870 874, windows-874, Thai (Windows) unknown encoding: 874 875, cp875, IBM EBCDIC Greek Modern unknown encoding: 875 932, shift_jis, ANSI/OEM Japanese; Japanese (Shift-JIS) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\隨ケ蜿、縺ソ縺ィ繧� (@sasakomitomo) 936, gb2312, ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\绗瑰彜銇裤仺銈� (@sasakomitomo) 949, ks_c_5601-1987, ANSI/OEM Korean (Unified Hangul Code) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\寧밧룮�겳�겏�굚 (@sasakomitomo) 950, big5, ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\蝚孵�扎�踴�具�� (@sasakomitomo) 1026, IBM1026, IBM EBCDIC Turkish (Latin 5) ãš*Ä?%%ÁÄÈÑ?>*À%Ë*[ÑÈ?_ÑÀ%*[ÑÈ?_Ñ^À?Ï>%?/ÀÁÀ^ÈÏÑÈÈÁÊ*X]¾V±uTa×TayTbb€ˆ Ë/Ë/,?_ÑÈ?_?‰ 1047, IBM01047, IBM EBCDIC Latin 1/Open System unknown encoding: 1047 1140, IBM01140, IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro) ãš*Ä?%%ÁÄÈÑ?>*À%Ë*ÇÑÈ?_ÑÀ%*ÇÑÈ?_ѬÀ?Ï>%?/ÀÁÀ¬ÈÏÑÈÈÁÊ*XоV±uTa×TayTbb€ˆ Ë/Ë/,?_ÑÈ?_?‰ 1141, IBM01141, IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro) unknown encoding: 1141 1142, IBM01142, IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro) unknown encoding: 1142 1143, IBM01143, IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro) unknown encoding: 1143 1144, IBM01144, IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro) unknown encoding: 1144 1145, IBM01145, IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro) unknown encoding: 1145 1146, IBM01146, IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro) unknown encoding: 1146 1147, IBM01147, IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro) unknown encoding: 1147 1148, IBM01148, IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro) unknown encoding: 1148 1149, IBM01149, IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro) unknown encoding: 1149 1200, utf-16, Unicode UTF-16, little endian byte order (BMP of ISO 10646); available only to managed applications unknown encoding: 1200 1201, unicodeFFFE, Unicode UTF-16, big endian byte order; available only to managed applications unknown encoding: 1201 1250, windows-1250, ANSI Central European; Central European (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古ă�żă�¨ă‚‚ (@sasakomitomo) 1251, windows-1251, ANSI Cyrillic; Cyrillic (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo) 1252, windows-1252, ANSI Latin 1; Western European (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ã�¿ã�¨ã‚‚ (@sasakomitomo) 1253, windows-1253, ANSI Greek; Greek (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\η¬Ήε�¤γ�Ώγ�¨γ‚‚ (@sasakomitomo) 1254, windows-1254, ANSI Turkish; Turkish (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ã�¿ã�¨ã‚‚ (@sasakomitomo) 1255, windows-1255, ANSI Hebrew; Hebrew (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ח¬¹ו�₪ד�¿ד�¨ד‚‚ (@sasakomitomo) 1256, windows-1256, ANSI Arabic; Arabic (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹هڈ¤مپ؟مپ¨م‚‚ (@sasakomitomo) 1257, windows-1257, ANSI Baltic; Baltic (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ē¬¹å¸¤ć�æć�Øć‚‚ (@sasakomitomo) 1258, windows-1258, ANSI/OEM Vietnamese; Vietnamese (Windows) F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ă�¿ă�¨ă‚‚ (@sasakomitomo) 1361, Johab, Korean (Johab) unknown encoding: 1361 10000, macintosh, MAC Roman; Western European (Mac) unknown encoding: 10000 10001, x-mac-japanese, Japanese (Mac) unknown encoding: 10001 10002, x-mac-chinesetrad, MAC Traditional Chinese (Big5); Chinese Traditional (Mac) unknown encoding: 10002 10003, x-mac-korean, Korean (Mac) unknown encoding: 10003 10004, x-mac-arabic, Arabic (Mac) unknown encoding: 10004 10005, x-mac-hebrew, Hebrew (Mac) unknown encoding: 10005 10006, x-mac-greek, Greek (Mac) unknown encoding: 10006 10007, x-mac-cyrillic, Cyrillic (Mac) unknown encoding: 10007 10008, x-mac-chinesesimp, MAC Simplified Chinese (GB 2312); Chinese Simplified (Mac) unknown encoding: 10008 10010, x-mac-romanian, Romanian (Mac) unknown encoding: 10010 10017, x-mac-ukrainian, Ukrainian (Mac) unknown encoding: 10017 10021, x-mac-thai, Thai (Mac) unknown encoding: 10021 10029, x-mac-ce, MAC Latin 2; Central European (Mac) unknown encoding: 10029 10079, x-mac-icelandic, Icelandic (Mac) unknown encoding: 10079 10081, x-mac-turkish, Turkish (Mac) unknown encoding: 10081 10082, x-mac-croatian, Croatian (Mac) unknown encoding: 10082 12000, utf-32, Unicode UTF-32, little endian byte order; available only to managed applications unknown encoding: 12000 12001, utf-32BE, Unicode UTF-32, big endian byte order; available only to managed applications unknown encoding: 12001 20000, x-Chinese_CNS, CNS Taiwan; Chinese Traditional (CNS) unknown encoding: 20000 20001, x-cp20001, TCA Taiwan unknown encoding: 20001 20002, x_Chinese-Eten, Eten Taiwan; Chinese Traditional (Eten) unknown encoding: 20002 20003, x-cp20003, IBM5550 Taiwan unknown encoding: 20003 20004, x-cp20004, TeleText Taiwan unknown encoding: 20004 20005, x-cp20005, Wang Taiwan unknown encoding: 20005 20105, x-IA5, IA5 (IRV International Alphabet No. 5, 7-bit); Western European (IA5) unknown encoding: 20105 20106, x-IA5-German, IA5 German (7-bit) unknown encoding: 20106 20107, x-IA5-Swedish, IA5 Swedish (7-bit) unknown encoding: 20107 20108, x-IA5-Norwegian, IA5 Norwegian (7-bit) unknown encoding: 20108 20127, us-ascii, US-ASCII (7-bit) unknown encoding: 20127 20261, x-cp20261, T.61 unknown encoding: 20261 20269, x-cp20269, ISO 6937 Non-Spacing Accent unknown encoding: 20269 20273, IBM273, IBM EBCDIC Germany unknown encoding: 20273 20277, IBM277, IBM EBCDIC Denmark-Norway unknown encoding: 20277 20278, IBM278, IBM EBCDIC Finland-Sweden unknown encoding: 20278 20280, IBM280, IBM EBCDIC Italy unknown encoding: 20280 20284, IBM284, IBM EBCDIC Latin America-Spain unknown encoding: 20284 20285, IBM285, IBM EBCDIC United Kingdom unknown encoding: 20285 20290, IBM290, IBM EBCDIC Japanese Katakana Extended unknown encoding: 20290 20297, IBM297, IBM EBCDIC France unknown encoding: 20297 20420, IBM420, IBM EBCDIC Arabic unknown encoding: 20420 20423, IBM423, IBM EBCDIC Greek unknown encoding: 20423 20424, IBM424, IBM EBCDIC Hebrew unknown encoding: 20424 20833, x-EBCDIC-KoreanExtended, IBM EBCDIC Korean Extended unknown encoding: 20833 20838, IBM-Thai, IBM EBCDIC Thai unknown encoding: 20838 20866, koi8-r, Russian (KOI8-R); Cyrillic (KOI8-R) unknown encoding: 20866 20871, IBM871, IBM EBCDIC Icelandic unknown encoding: 20871 20880, IBM880, IBM EBCDIC Cyrillic Russian unknown encoding: 20880 20905, IBM905, IBM EBCDIC Turkish unknown encoding: 20905 20924, IBM00924, IBM EBCDIC Latin 1/Open System (1047 + Euro symbol) unknown encoding: 20924 20932, EUC-JP, Japanese (JIS 0208-1990 and 0212-1990) unknown encoding: 20932 20936, x-cp20936, Simplified Chinese (GB2312); Chinese Simplified (GB2312-80) unknown encoding: 20936 20949, x-cp20949, Korean Wansung unknown encoding: 20949 21025, cp1025, IBM EBCDIC Cyrillic Serbian-Bulgarian unknown encoding: 21025 21027, None, (deprecated) unknown encoding: 21027 21866, koi8-u, Ukrainian (KOI8-U); Cyrillic (KOI8-U) unknown encoding: 21866 28591, iso-8859-1, ISO 8859-1 Latin 1; Western European (ISO) unknown encoding: 28591 28592, iso-8859-2, ISO 8859-2 Central European; Central European (ISO) unknown encoding: 28592 28593, iso-8859-3, ISO 8859-3 Latin 3 D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古ă�żă�¨ă‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x81 in position 61: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\η¬Ήε�¤γ�Ώγ�¨γ‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x8f in position 58: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ח¬¹ו�₪ד�¿ד�¨ד‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x8f in position 58: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\ē¬¹å¸¤ć�æć�Øć‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x81 in position 61: character maps to ) warnings.warn(msg) D:\libraries\repositories\dev\shortcut2symlink\.venv\Lib\site-packages\LnkParse3\text_processor.py:26: UserWarning: Error while decoding string `F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹å�¤ă�¿ă�¨ă‚‚ (@sasakomitomo)` ('charmap' codec can't decode byte 0x8f in position 58: character maps to ) warnings.warn(msg) unknown encoding: 28593 28594, iso-8859-4, ISO 8859-4 Baltic unknown encoding: 28594 28595, iso-8859-5, ISO 8859-5 Cyrillic unknown encoding: 28595 28596, iso-8859-6, ISO 8859-6 Arabic unknown encoding: 28596 28597, iso-8859-7, ISO 8859-7 Greek unknown encoding: 28597 28598, iso-8859-8, ISO 8859-8 Hebrew; Hebrew (ISO-Visual) unknown encoding: 28598 28599, iso-8859-9, ISO 8859-9 Turkish unknown encoding: 28599 28603, iso-8859-13, ISO 8859-13 Estonian unknown encoding: 28603 28605, iso-8859-15, ISO 8859-15 Latin 9 unknown encoding: 28605 29001, x-Europa, Europa 3 unknown encoding: 29001 38598, iso-8859-8-i, ISO 8859-8 Hebrew; Hebrew (ISO-Logical) unknown encoding: 38598 50220, iso-2022-jp, ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS) unknown encoding: 50220 50221, csISO2022JP, ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana) unknown encoding: 50221 50222, iso-2022-jp, ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI) unknown encoding: 50222 50225, iso-2022-kr, ISO 2022 Korean unknown encoding: 50225 50227, x-cp50227, ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022) unknown encoding: 50227 50229, ISO, 2022 Traditional Chinese unknown encoding: 50229 50930, None, EBCDIC Japanese (Katakana) Extended unknown encoding: 50930 50931, None, EBCDIC US-Canada and Japanese unknown encoding: 50931 50933, None, EBCDIC Korean Extended and Korean unknown encoding: 50933 50935, None, EBCDIC Simplified Chinese Extended and Simplified Chinese unknown encoding: 50935 50936, None, EBCDIC Simplified Chinese unknown encoding: 50936 50937, None, EBCDIC US-Canada and Traditional Chinese unknown encoding: 50937 50939, None, EBCDIC Japanese (Latin) Extended and Japanese unknown encoding: 50939 51932, euc-jp, EUC Japanese unknown encoding: 51932 51936, EUC-CN, EUC Simplified Chinese; Chinese Simplified (EUC) unknown encoding: 51936 51949, euc-kr, EUC Korean unknown encoding: 51949 51950, EUC, Traditional Chinese unknown encoding: 51950 52936, hz-gb-2312, HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ) unknown encoding: 52936 54936, GB18030, Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030) unknown encoding: 54936 57002, x-iscii-de, ISCII Devanagari unknown encoding: 57002 57003, x-iscii-be, ISCII Bangla unknown encoding: 57003 57004, x-iscii-ta, ISCII Tamil unknown encoding: 57004 57005, x-iscii-te, ISCII Telugu unknown encoding: 57005 57006, x-iscii-as, ISCII Assamese unknown encoding: 57006 57007, x-iscii-or, ISCII Odia unknown encoding: 57007 57008, x-iscii-ka, ISCII Kannada unknown encoding: 57008 57009, x-iscii-ma, ISCII Malayalam unknown encoding: 57009 57010, x-iscii-gu, ISCII Gujarati unknown encoding: 57010 57011, x-iscii-pa, ISCII Punjabi unknown encoding: 57011 65000, utf-7, Unicode (UTF-7) unknown encoding: 65000 65001, utf-8, Unicode (UTF-8) unknown encoding: 65001 Process finished with exit code 0 ```

For reference, chcp in command prompt returns Active code page: 437 and [System.Text.Encoding]::Default in powershell returns:

IsSingleByte      : True
BodyName          : iso-8859-1
EncodingName      : Western European (Windows)
HeaderName        : Windows-1252
WebName           : Windows-1252
WindowsCodePage   : 1252
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
EncoderFallback   : System.Text.InternalEncoderBestFitFallback
DecoderFallback   : System.Text.InternalDecoderBestFitFallback
IsReadOnly        : True
CodePage          : 1252
Matmaus commented 5 months ago

Hi, sorry for the longer inactivity.

1) You have actually found the correct codepage - UTF-8. It works for file in the first ZIP. I can add UTF-8 encding as a pre-fallback when decoding with the given codepage fails (the last fallback will remain the same - use the given codepage but repace unknown characters).

$ lnkparse 笹古みとも\ \(@sasakomitomo\).lnk -c utf-8
...
   LINK INFO:
      Link info flags: 1
      Local base path: F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)
      Common path suffix:
      LOCAL:
         Drive type: 3
         Drive serial number: 0x280e8914
         Drive type: DRIVE_FIXED
         Volume label:

   DATA
      Relative path: ..\..\..\collection\dls\hitomi-dl\hitomi_downloaded_twitter\笹古みとも (@sasakomitomo)
...

2) Regarding files in the second ZIP, the question marks are actually stored in the binary itself, so there is nothing wrong with the decoding process I think

$ cat lnk.files/𝙄𝙣𝙙𝙞𝙜𝙤\ 🦊\ \(@IndigoBeatss\).lnk
LF
8QU//F:\tY^Hg3(w,/J>V
                     h`1collectionF     .collectionJ1dls8       .dls\1hitomi-dlD        .hitomi-dl1hitomi_downloaded_twitterd   .hitomi_downloaded_twitter(55D5c5Y5^5\5d >؊ (@IndigoBeatss)p   .5D5c5Y5^5\5d >؊ (@IndigoBeatss)N<$$58:(F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\???????????? ?? (@IndigoBeatss)F:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\5D5c5Y5^5\5d >؊ (@IndigoBeatss)[..\..\..\collection\dls\hitomi-dl\hitomi_downloaded_twitter\5D5c5Y5^5\5d >؊ (@IndigoBeatss)`Xdesktop-l0vtu6nl1luFo<@ Ӗ*{l1luFo<@ Ӗ*{Q       1SPS0CGsf"d8hitomi_downloaded_twitter (F:\collection\dls\hitomi-dl)1SPS0%G`Q
 5D5c5Y5^5\5d >؊ (@IndigoBeatss))
                                 File folder1SPSjc(=OнVF:\collection\dls\hitomi-dl\hitomi_downloaded_twitter\5D5c5Y5^5\5d >؊ (@IndigoBeatss)91SPSmDpHH@.=xhH
pJrHfֽi%

image

gdesmar commented 5 months ago

It may be a difference between Windows/WSL and Linux, but for the first example, lnk_file.info.local_base_path() works for me, while lnk_file.info.local_base_path_unicode() works for all the files in the second zip. You could try to use the following? It would be good enough on my Linux, but you would need to validate on Windows.

def get_target(lnk_path, code_page):
    with open(lnk_path, "rb") as indata:
        lnk_file = LnkParse3.lnk_file(indata, cp=code_page)
        return lnk_file.info.local_base_path_unicode() or lnk_file.info.local_base_path()

Looking at your big test script to test all encodings, I can see that you are looping on your list with

    for identifier, net_name, additional_info in code_page_identifiers:
        print(f'{identifier}, {net_name}, {additional_info}')
        try:
            print(f'{get_target(lnk_path, identifier)}\n')

Could you try with

            print(f'{get_target(lnk_path, net_name)}\n') # <- Modified for net_name

Looking at UTF-8 (the last entry in your list), you end up using lnk_file = LnkParse3.lnk_file(indata, cp="65001") instead of lnk_file = LnkParse3.lnk_file(indata, cp="utf-8"). This causes lnk.info.local_base_path() to error out with LookupError: unknown encoding: 65001, as per your output. If you used "utf-8", you should have the question marks. From my tests, it looks like that both "utf-8" or "65001" would give your the right value with lnk_file.info.local_base_path_unicode().

Hopefully that will help a little! 🙂