[Bug 56160] New: Kernel32: Unable to determine encoding format without [BOM] sequence.(PROFILE_DetectTextEncoding)
https://bugs.winehq.org/show_bug.cgi?id=56160 Bug ID: 56160 Summary: Kernel32: Unable to determine encoding format without [BOM] sequence.(PROFILE_DetectTextEncoding) Product: Wine Version: 9.0-rc4 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: kernel32 Assignee: wine-bugs(a)winehq.org Reporter: zmtong1988(a)gmail.com Distribution: --- Question: 1. Open the [UTF-8] encoding file, and if there is no [BOM] sequence, recognize it as [ENCODING-ANSI] through [PROFILE-DetectTextEncoding] instead of [UTF-8]. 2. Open the [UTF-16 LE] encoding file, and if there is no [BOM] sequence, recognize it as [ENCODING-ANSI] through [PROFILE-DetectTextEncoding] instead of [UTF-16 LE]. Function execution process: [ dlls/kenel32/profile. c ] --> [ PROFILE_ Open ] -->[ PROFILE_ Load ] -->[ PROFILE-DetectTextEncoding ] Description: Open a file in [UTF-16 LE] encoding format and execute [ PROFILE_ DetectTextEncoding ]always returns [ ENCODING-ANSI ], and subsequent parsing work cannot be completed according to the encoding format. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #1 from Maotong Zhang <zmtong1988(a)gmail.com> --- Can call to open .ini file for testing -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 Zeb Figura <z.figura12(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Ever confirmed|0 |1 CC| |z.figura12(a)gmail.com --- Comment #2 from Zeb Figura <z.figura12(a)gmail.com> --- What application does this affect? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #3 from Maotong Zhang <zmtong1988(a)gmail.com> --- (In reply to Zeb Figura from comment #2)
What application does this affect?
Wine compiles and generates [win. ini] and [system. ini] using [PROFILE_DetectTextEncoding] to determine that they are also of the [ENCODING_ANSI] type. This does not affect the usage, UTF-8 and ANSI are basically the same and can be parsed. If UTF-16 is used for parsing, there may be issues. For example: When the program calls GetPrivateProfileSectionNamesW to retrieve the names of all sections in the . ini file (UTF-16 LE), an issue occurs. Function Procedure: [GetPrivateProfileSectionNamesW] -->[PROFILE_Open] -->[PROFILE_Load] -->[PROFILE_DetectTextEncoding] Result: When executing [PROFILE_DetectTextEncoding], as there is no BOM sequence, it cannot be determined and returns [ENCODING_ANSI]. When calculating [PROFILE_Load], it is correct to use [ENCODING_ANSI] for calculation, which results in the inability to parse the file. -------------------- static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) { ...... len = dwFileSize; *pEncoding = PROFILE_DetectTextEncoding(buffer_base, &len); /* len is set to the number of bytes in the character marker. * we want to skip these bytes */ pBuffer = (char *)buffer_base + len; dwFileSize -= len; switch (*pEncoding) { case ENCODING_ANSI: TRACE("ANSI encoding\n"); len = MultiByteToWideChar(CP_ACP, 0, pBuffer, dwFileSize, NULL, 0); szFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (!szFile) { HeapFree(GetProcessHeap(), 0, buffer_base); return NULL; } MultiByteToWideChar(CP_ACP, 0, pBuffer, dwFileSize, szFile, len); szEnd = szFile + len; break; ...... case ENCODING_UTF16LE: TRACE("UTF16 Little Endian encoding\n"); szFile = pBuffer; szEnd = (WCHAR *)((char *)pBuffer + dwFileSize); break; .... } -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #4 from Zeb Figura <z.figura12(a)gmail.com> --- What application are you trying to run with Wine, that is failing due to this bug? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #5 from Maotong Zhang <zmtong1988(a)gmail.com> --- Created attachment 75853 --> https://bugs.winehq.org/attachment.cgi?id=75853 Test program -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #6 from Maotong Zhang <zmtong1988(a)gmail.com> --- Created attachment 75854 --> https://bugs.winehq.org/attachment.cgi?id=75854 程序代码 program code -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 Maotong Zhang <zmtong1988(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #75854|程序代码 program code |program code description| | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #7 from Maotong Zhang <zmtong1988(a)gmail.com> --- Created attachment 75855 --> https://bugs.winehq.org/attachment.cgi?id=75855 test file -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #8 from Maotong Zhang <zmtong1988(a)gmail.com> --- (In reply to Zeb Figura from comment #4)
What application are you trying to run with Wine, that is failing due to this bug?
Test program : Created attachment 75853 [details] program code : Created attachment 75854 [details] test file :Created attachment 75855 [details] run: Place the Test.ini file in the [ drive_c ] directory of the container. Run the test. exe file using Wine. View the results. Result: The test program can read file contents under Windows, and using Wine is incorrect. [PROFILE DetectTextEncoding] parsed [ENCODING ANSI] instead of the correct [UTF-16 LE] encoding, resulting in file read errors. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #9 from Maotong Zhang <zmtong1988(a)gmail.com> --- (In reply to Zeb Figura from comment #4)
What application are you trying to run with Wine, that is failing due to this bug?
I tried to make a judgment when there was no BOM sequence, determine the corresponding file encoding format, but several attempts have failed. I don't know how to improve and determine the encoding format. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #10 from Maotong Zhang <zmtong1988(a)gmail.com> --- (In reply to Zeb Figura from comment #4)
What application are you trying to run with Wine, that is failing due to this bug?
Can you guide me on how to fix this issue? Thank you~ -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=56160 Andrew Nguyen <arethusa26(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #11 from Andrew Nguyen <arethusa26(a)gmail.com> --- Bug 58202 identifies an existing application that is impacted by the same issue described here when it uses GetPrivateProfileStringW to retrieve UI strings from a UTF-16LE file without a BOM. This issue still occurs with wine-10.7. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=56160 Andrew Nguyen <arethusa26(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zbox(a)atlas.cz --- Comment #12 from Andrew Nguyen <arethusa26(a)gmail.com> --- *** Bug 58202 has been marked as a duplicate of this bug. *** -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=56160 --- Comment #13 from Maotong Zhang <zmtong1988(a)gmail.com> --- Created attachment 78540 --> http://bugs.winehq.org/attachment.cgi?id=78540 temporary patch I wrote a temporary patch before, you can test it. There is currently no time to write a universal patch. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla