https://bugs.winehq.org/show_bug.cgi?id=42736
Bug ID: 42736 Summary: scanf doesn't work as expected when using format string contains non-ascii chars Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: zhangboyang.id@gmail.com Distribution: ---
Created attachment 57728 --> https://bugs.winehq.org/attachment.cgi?id=57728 working example, should link msvcrt.dll (e.g. use mingw to compile)
(1) assume test.txt has this content
hexdump -C test.txt 00000000 ef bb bf 68 65 6c 6c 6f |...hello| 00000008
// the content is UTF8 BOM + "hello"
(2) fscanf(fp, "\xef\xbb\xbf") doesn't work as expected (using crossover 16.2.0)
char s[1000]; fscanf(fp, "\xef\xbb\xbf"); ///// won't read utf-8 bom as expected fscanf(fp, "%s", s);
/opt/cxoffice/bin/wine test.exe | hexdump -C 00000000 73 3d ef bb bf 68 65 6c 6c 6f 0d 0a |s=...hello..| 0000000c
(3) expected behavior is (under windows) E:\winebug>test2 s=hello